Skip to content

--cap-lints and related affect crate hash #87144

Closed
@jsgf

Description

@jsgf

I tried this code t.rs:

pub fn foo() {}

I'd expect the output of:

rustc --crate-type rlib --emit link t.rs
rustc --crate-type rlib --emit link --cap-lints=warn t.rs
rustc --crate-type rlib --emit link -Ddead-code t.rs

to all produce the same output from

rustc -Zls libt.rs

since this only affects the diagnostics and nothing about the crate itself (other than whether the crate is generated at all,
if an error is converted to a warning).

Instead, they all get different crate hashes:
(nothing)

Crate info:
name t
hash 5a3a7bb9cc8aaa16 stable_crate_id StableCrateId(18443930956397526271)

--cap-lints=warn:

Crate info:
name t
hash 99f5dd1f2478b80a stable_crate_id StableCrateId(18443930956397526271)

-Ddead-code:

Crate info:
name t
hash ffe4791362102371 stable_crate_id StableCrateId(18443930956397526271)

Meta

rustc --version --verbose:

rustc 1.55.0-nightly (3e1c75c6e 2021-07-13)
binary: rustc
commit-hash: 3e1c75c6e25a4db968066bd2ef2dabc7c504d7ca
commit-date: 2021-07-13
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions