Impls and impl items inherit dead_code lint level of the corresponding traits and trait items#144113
Conversation
compiler-errors
left a comment
There was a problem hiding this comment.
This behavior seems really non-local and pretty broad. #[allow(dead_code)] on a trait definition suppresses all dead code warnings in all impls with this change?
7eba1f1 to
7a9e2e2
Compare
@compiler-errors yes, and I think this makes sense. We would have only one trait definition but many impls, letting |
I tried reassigning, but rustbot didn’t respond after waiting a while, so I deleted the comment. 😂 |
|
☔ The latest upstream changes (presumably #144863) made this pull request unmergeable. Please resolve the merge conflicts. |
7a9e2e2 to
c1be949
Compare
|
@rustbot ready |
|
@cjgillot gentle ping for a review here |
|
Nominated the issue for lang team discussion, let's see what they think before merging. |
|
oh, I missed the and if the trait is non-local, the dead-code lint level won't spread to the local impls. cc @wesleywiser we only care about local traits, see https://github.com/rust-lang/rust/pull/144113/files#diff-719b4f36bbbf3b3bf48683429408f5d27e5633f70c1144a93554bd536d5bf655R786 |
…rait, r=jdonszelmann Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items https://github.com/rust-lang/rust/blob/master/compiler/rustc_passes/src/dead.rs#L360-L361 won't insert assoc items into the live set, so that impl items cannot be marked live. This PR lets impls and impl items can inherit lint levels of the corresponding traits and trait items. Fixes rust-lang#144060 r? `@petrochenkov`
Rollup of 8 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150668 (Unix implementation for stdio set/take/replace) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150710 (Update libc dependency of std) r? `@ghost` `@rustbot` modify labels: rollup
…rait, r=jdonszelmann Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items https://github.com/rust-lang/rust/blob/master/compiler/rustc_passes/src/dead.rs#L360-L361 won't insert assoc items into the live set, so that impl items cannot be marked live. This PR lets impls and impl items can inherit lint levels of the corresponding traits and trait items. Fixes rust-lang#144060 r? ``@petrochenkov``
Rollup of 8 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150668 (Unix implementation for stdio set/take/replace) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) r? `@ghost` `@rustbot` modify labels: rollup
…rait, r=jdonszelmann Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items https://github.com/rust-lang/rust/blob/master/compiler/rustc_passes/src/dead.rs#L360-L361 won't insert assoc items into the live set, so that impl items cannot be marked live. This PR lets impls and impl items can inherit lint levels of the corresponding traits and trait items. Fixes rust-lang#144060 r? ```@petrochenkov```
…uwer Rollup of 11 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #148339 (naked functions: emit `.private_extern` on macos) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150122 (Refactor function names of `rustc_ast_lowering`) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150707 (Fix ICE when transmute Assume field is invalid) - #150708 (Enable merge queue in new bors) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 11 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #148339 (naked functions: emit `.private_extern` on macos) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150122 (Refactor function names of `rustc_ast_lowering`) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150707 (Fix ICE when transmute Assume field is invalid) - #150708 (Enable merge queue in new bors) r? `@ghost` `@rustbot` modify labels: rollup
…uwer Rollup of 10 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150122 (Refactor function names of `rustc_ast_lowering`) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150707 (Fix ICE when transmute Assume field is invalid) - #150708 (Enable merge queue in new bors) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #144113 - mu001999-contrib:dead-code/allow-trait, r=jdonszelmann Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items https://github.com/rust-lang/rust/blob/master/compiler/rustc_passes/src/dead.rs#L360-L361 won't insert assoc items into the live set, so that impl items cannot be marked live. This PR lets impls and impl items can inherit lint levels of the corresponding traits and trait items. Fixes #144060 r? ````@petrochenkov````
|
Candidate for the perf regression in #150726 |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (bb5b182): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 4.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 473.921s -> 475.634s (0.36%) |
|
Yeah seems like this PR is the cause sadly, what action should we take to resolve this? |
|
I'm going to mark as triaged. This only significantly affected bitmaps in the non-incremental scenarios, and the change looks fairly minimal to me -- not clear that it could be made any better -- so I don't think there's much to be done here given this is effectively a new feature. |
Pkgsrc changes: * Update version & checksums. * Adapt patches to new vendored crates. This has so far just been verified to build on NetBSD/amd64. Upstream changes relative to 1.93.1: Version 1.94.0 (2026-03-05) ========================== Language -------- - [Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items] (rust-lang/rust#144113) - [Stabilize additional 29 RISC-V target features including large portions of the RVA22U64 / RVA23U64 profiles] (rust-lang/rust#145948) - [Add warn-by-default `unused_visibilities` lint for visibility on `const _` declarations] (rust-lang/rust#147136) - [Update to Unicode 17] (rust-lang/rust#148321) - [Avoid incorrect lifetime errors for closures] (rust-lang/rust#148329) Platform Support ---------------- - [Add `riscv64im-unknown-none-elf` as a tier 3 target] (rust-lang/rust#148790) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. [platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html Libraries --------- - [Relax `T: Ord` bound for some `BinaryHeap<T>` methods.] (rust-lang/rust#149408) Stabilized APIs --------------- - [`<[T]>::array_windows`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.array_windows) - [`<[T]>::element_offset`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.element_offset) - [`LazyCell::get`] (https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.get) - [`LazyCell::get_mut`] (https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.get_mut) - [`LazyCell::force_mut`] (https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.force_mut) - [`LazyLock::get`] (https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.get) - [`LazyLock::get_mut`] (https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.get_mut) - [`LazyLock::force_mut`] (https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.force_mut) - [`impl TryFrom<char> for usize`] (https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3Cchar%3E-for-usize) - [`std::iter::Peekable::next_if_map`] (https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_map) - [`std::iter::Peekable::next_if_map_mut`] (https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_map_mut) - [x86 `avx512fp16` intrinsics] (rust-lang/rust#127213) (excluding those that depend directly on the unstable `f16` type) - [AArch64 NEON fp16 intrinsics] (rust-lang/rust#136306) (excluding those that depend directly on the unstable `f16` type) - [`f32::consts::EULER_GAMMA`] (https://doc.rust-lang.org/stable/std/f32/consts/constant.EULER_GAMMA.html) - [`f64::consts::EULER_GAMMA`] (https://doc.rust-lang.org/stable/std/f64/consts/constant.EULER_GAMMA.html) - [`f32::consts::GOLDEN_RATIO`] (https://doc.rust-lang.org/stable/std/f32/consts/constant.GOLDEN_RATIO.html) - [`f64::consts::GOLDEN_RATIO`] (https://doc.rust-lang.org/stable/std/f64/consts/constant.GOLDEN_RATIO.html) These previously stable APIs are now stable in const contexts: - [`f32::mul_add`] (https://doc.rust-lang.org/stable/std/primitive.f32.html#method.mul_add) - [`f64::mul_add`] (https://doc.rust-lang.org/stable/std/primitive.f64.html#method.mul_add) Cargo ----- - Stabilize the config include key. The top-level include config key allows loading additional config files, enabling better organization, sharing, and management of Cargo configurations across projects and environments. [docs] (https://doc.rust-lang.org/nightly/cargo/reference/config.html#including-extra-configuration-files) [#16284] (rust-lang/cargo#16284) - Stabilize the pubtime field in registry index. This records when a crate version was published and enables time-based dependency resolution in the future. Note that crates.io will gradually backfill existing packages when a new version is published. Not all crates have pubtime yet. [#16369] (rust-lang/cargo#16369) [#16372] (rust-lang/cargo#16372) - Cargo now parses [TOML v1.1](https://toml.io/en/v1.1.0) for manifests and configuration files. Note that using these features in Cargo.toml will raise your development MSRV, but the published manifest remains compatible with older parsers. [#16415] (rust-lang/cargo#16415) - [Make `CARGO_BIN_EXE_<crate>` available at runtime ] (rust-lang/cargo#16421) Compatibility Notes ------------------- - [Forbid freely casting lifetime bounds of `dyn`-types] (rust-lang/rust#136776) - [Make closure capturing have consistent and correct behaviour around patterns] (rust-lang/rust#138961) Some finer details of how precise closure captures get affected by pattern matching have been changed. In some cases, this can cause a non-move closure that was previously capturing an entire variable by move, to now capture only part of that variable by move, and other parts by borrow. This can cause the borrow checker to complain where it previously didn't, or cause `Drop` to run at a different point in time. - [Standard library macros are now imported via prelude, not via injected ` #[macro_use]`] (rust-lang/rust#139493) This will raise an error if macros of the same name are glob imported. For example if a crate defines their own `matches` macro and then glob imports that, it's now ambiguous whether the custom or standard library `matches` is meant and an explicit import of the name is required to resolve the ambiguity. One exception is `core::panic` and `std::panic`, if their import is ambiguous a new warning ([`ambiguous_panic_imports`] (rust-lang/rust#147319)) is raised. This may raise a new warning ([`ambiguous_panic_imports`] (rust-lang/rust#147319)) on `#![no_std]` code glob importing the std crate. Both `core::panic!` and `std::panic!` are then in scope and which is used is ambiguous. - [Don't strip shebang in expression-context `include!(…)`s] (rust-lang/rust#146377) This can cause previously working includes to no longer compile if they included files which started with a shebang. - [Ambiguous glob reexports are now also visible cross-crate] (rust-lang/rust#147984) This unifies behavior between local and cross-crate errors on these exports, which may introduce new ambiguity errors. - [Don't normalize where-clauses before checking well-formedness] (rust-lang/rust#148477) - [Introduce a future compatibility warning on codegen attributes on body-free trait methods] (rust-lang/rust#148756) These attributes currently have no effect in this position. - [On Windows `std::time::SystemTime::checked_sub_duration` will return `None` for times before the Windows epoch (1/1/1601)] (rust-lang/rust#148825) - [Lifetime identifiers such as `'a` are now NFC normalized] (rust-lang/rust#149192). - [Overhaul filename handling for cross-compiler consistency] (rust-lang/rust#149709) Any paths emitted by compiler now always respect the relative-ness of the paths and `--remap-path-prefix` given originally. One side-effect of this change is that paths emitted for local crates in Cargo (path dependencies and workspace members) are no longer absolute but relative when emitted as part of a diagnostic in a downstream crate. Internal Changes ---------------- These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools. - [Switch to `annotate-snippets` for error emission] (rust-lang/rust#150032) This should preserve mostly the same outputs in rustc error messages.
https://github.com/rust-lang/rust/blob/master/compiler/rustc_passes/src/dead.rs#L360-L361 won't insert assoc items into the live set, so that impl items cannot be marked live.
This PR lets impls and impl items can inherit lint levels of the corresponding traits and trait items.
Fixes #144060
r? @petrochenkov