Skip to content

Commit

Permalink
Rollup merge of rust-lang#127107 - mu001999-contrib:dead/enhance-2, r…
Browse files Browse the repository at this point in the history
…=pnkfelix

Improve dead code analysis

Fixes rust-lang#120770

1. check impl items later if self ty is private although the trait method is public, cause we must use the ty firstly if it's private
2. mark the adt live if it appears in pattern, like generic argument, this implies the use of the adt
3. based on the above, we can handle the case that private adts impl Default, so that we don't need adding rustc_trivial_field_reads on Default, and the logic in should_ignore_item

r? ``@pnkfelix``
  • Loading branch information
compiler-errors authored Jul 6, 2024
2 parents 1b5e5ac + f58a3d6 commit 3eeca5f
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion core/src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ use crate::ascii::Char as AsciiChar;
/// ```
#[cfg_attr(not(test), rustc_diagnostic_item = "Default")]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_trivial_field_reads)]
pub trait Default: Sized {
/// Returns the "default value" for a type.
///
Expand Down

0 comments on commit 3eeca5f

Please sign in to comment.