Closed Aleksbgbg closed 2 weeks ago
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?
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.
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.
I no longer see the issue in 0.8.0-alpha.25 :)
Awesome, thanks for following up!
Would it be possible to adjust zerocopy's macros to disambiguate the root core namespace (by using
::core
instead ofcore
everywhere)? I'm working on a project where there is acrate::core
namespace which causes failures when the derive macros are evaluated.