Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zerocopy Derives Use core Namespace Instead of ::core #1536

Open
Aleksbgbg opened this issue Jul 20, 2024 · 3 comments
Open

Zerocopy Derives Use core Namespace Instead of ::core #1536

Aleksbgbg opened this issue Jul 20, 2024 · 3 comments

Comments

@Aleksbgbg
Copy link

Would it be possible to adjust zerocopy's macros to disambiguate the root core namespace (by using ::core instead of core everywhere)? I'm working on a project where there is a crate::core namespace which causes failures when the derive macros are evaluated.

@jswrenn
Copy link
Collaborator

jswrenn commented Jul 20, 2024

Yes, that's absolutely possible and we strive to do it everywhere already. If we've missed a spot, that's a minor soundness bug.

What version of zerocopy are you using? Is there a particular macro that you're having trouble with?

@Aleksbgbg
Copy link
Author

Aleksbgbg commented Jul 27, 2024

I am running into this on zerocopy 0.7.35 and Rust Nightly 1.82.0. Strangely, I tried to reproduce this just now and could no longer do so on Windows (the last time I tried this was ~2 months ago), however when I uploaded my code to GitLab, it failed to build on the Linux docker container running on the build server: https://gitlab.com/Aleksbgbg/opencraft/-/jobs/7443005160. The change that switches to using zerocopy and fails the build can be viewed at https://gitlab.com/Aleksbgbg/opencraft/-/commit/f372e3449ec162b4f7e9e7250fb2a8c05b0fb7bc, it is only a small diff.

Note also #[derive(AsBytes)] is only failing in opencraft/src/main.rs where mod core; is present (not in opencraft/src/core/math/mat4.rs). The error complains about core::mem missing, which is of course the case as my core module does not have a mem module.

@joshlf
Copy link
Member

joshlf commented Sep 20, 2024

Are you still seeing this issue? If so, does it work on 0.8.0-alpha.22? We are about to release 0.8 stably, at which point we will stop actively maintaining 0.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants