You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Running sanitizer tests fails with mixed ABI errors #147394
error: mixing `-Zsanitizer` will cause an ABI mismatch incrate `hashlink`
|
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
= note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=memory` in dependency `core`
= help: set `-Zsanitizer=memory` in this crate or unset `-Zsanitizer` in `core`
= help:if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
Note that I already added the suppression option, but it doesn't seem to take effect here?
I led you astray. Using -Zbuild-std without --target makes Cargo rebuild the standard library but doesn't put it into cross-compilation mode, which leads to the RUSTFLAGS being applied to host builds (proc macros and build scripts) but they are still built against the precompiled sysroot.
AddressSanitizer supports partially-instrumented builds, and MemorySanitizer does not. These false positives are the outcome, and there are handful of closed issues on the tracker of people filing bugs against the standard library because the toolchain let them misconfigure a build and get a report that looks like a true positive, but isn't. You are using -Cunsafe-allow-abi-mismatch to bypass the check that was written to prevent this situation :p
Yes, if djc actually wants to run doctests, that would be #146465. I still think there is a diagnostic problem here, we shouldn't have diagnostics that lead to the confusion reported in the original issue description:
Note that I already added the suppression option, but it doesn't seem to take effect here?
Note that I already added the suppression option, but it doesn't seem to take effect here?
If the error is about a doctest (not enough context to tell because the error message you pasted doesn't show the line at which the error occurs), you should add the suppression option to RUSTDOCFLAGS, not RUSTFLAGS. Perhaps that's where the confusion is coming from?
Activity
djc commentedon Oct 15, 2025
@saethlin thanks a lot for digging in! This allowed me to make some progress.
First, I still needed
-Cunsafe-allow-abi-mismatch=sanitizerinRUSTFLAGSas well, otherwise it complained aboutbuild_script_buildtargets.Second, I'm now getting this error:
Is this worth an issue against compiler-builtins? Or maybe there is a suppression mechanism somewhere...
saethlin commentedon Oct 15, 2025
I led you astray. Using
-Zbuild-stdwithout--targetmakes Cargo rebuild the standard library but doesn't put it into cross-compilation mode, which leads to the RUSTFLAGS being applied to host builds (proc macros and build scripts) but they are still built against the precompiled sysroot.AddressSanitizer supports partially-instrumented builds, and MemorySanitizer does not. These false positives are the outcome, and there are handful of closed issues on the tracker of people filing bugs against the standard library because the toolchain let them misconfigure a build and get a report that looks like a true positive, but isn't. You are using
-Cunsafe-allow-abi-mismatchto bypass the check that was written to prevent this situation :pdjc commentedon Oct 15, 2025
Thanks a lot! Was finally able to fix hashlink CI so we can get updates rolling again.
Thomasdezeeuw commentedon Oct 15, 2025
Seems like this is the same issue as #146465?
Anyone looking for a quick fix using
--all-targetsskips the tests for docs, so:Don't run doc tests with sanitizer
Don't run doc tests with sanitizer (#1908)
saethlin commentedon Oct 15, 2025
Yes, if djc actually wants to run doctests, that would be #146465. I still think there is a diagnostic problem here, we shouldn't have diagnostics that lead to the confusion reported in the original issue description:
gendx commentedon Oct 22, 2025
If the error is about a doctest (not enough context to tell because the error message you pasted doesn't show the line at which the error occurs), you should add the suppression option to
RUSTDOCFLAGS, notRUSTFLAGS. Perhaps that's where the confusion is coming from?saethlin commentedon Oct 22, 2025
That has already been mentioned in #147394 (comment) but be aware that GitHub is hiding most of this thread because of the backlinks.