Skip to content

Can't find thiserror_impl crate with -Z sanitizer #132109

Open
@ColonelThirtyTwo

Description

@ColonelThirtyTwo

I tried this code:

// (empty lib.rs)

Cargo.toml:

[package]
name = "nightly-cant-find-crate-test"
version = "0.1.0"
edition = "2021"

[dependencies]
thiserror = "1.0.65"

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:

> env RUSTFLAGS="-Z sanitizer=address" cargo +nightly build
   Compiling proc-macro2 v1.0.89
   Compiling unicode-ident v1.0.13
   Compiling thiserror v1.0.65
   Compiling quote v1.0.37
   Compiling syn v2.0.85
   Compiling thiserror-impl v1.0.65
error[E0463]: can't find crate for `thiserror_impl`
   --> /home/col/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.65/src/lib.rs:278:9
    |
278 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.

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:

> rustup run nightly rustc --version
rustc 1.84.0-nightly (4f2f477fd 2024-10-23)
> cargo --version
cargo 1.82.0 (8f40fc59f 2024-08-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sanitizersArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions