Open ColonelThirtyTwo opened 2 hours ago
You have to pass --target
flag.
See also documentation of -Z sanitizer
:
Build scripts and procedural macros
Use of sanitizers together with build scripts and procedural macros is technically possible, but in almost all cases it would be best avoided. This is especially true for procedural macros which would require an instrumented version of rustc.
In more practical terms when using cargo always remember to pass
--target
flag, so that rustflags will not be applied to build scripts and procedural macros.
Setting the target worked, thank you. A warning message would be helpful though.
I tried this code:
Cargo.toml:
Compiling with
env RUSTFLAGS="-Z sanitizer=address" cargo +nightly build
I expected to see this happen: Library compiles
Instead, this happened: Rust fails to find the crate
thiserror_impl
, even though it's a transitive dependency:The crate builds without errors if I omit the sanitizer option, or replace it with something else like
-Zub-checks
. It also obviously builds with stable Rust.Meta
rustc --version --verbose
: