Skip to content

Commit

Permalink
Rollup merge of rust-lang#121899 - shepmaster:dead-code-docs, r=wesle…
Browse files Browse the repository at this point in the history
…ywiser

Document how removing a type's field can be bad and what to do instead

Related to rust-lang#119645
  • Loading branch information
matthiaskrgr authored Mar 14, 2024
2 parents e9907ff + 71080dd commit e0cac76
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,20 @@ declare_lint! {
/// `PhantomData`.
///
/// Otherwise consider removing the unused code.
///
/// ### Limitations
///
/// Removing fields that are only used for side-effects and never
/// read will result in behavioral changes. Examples of this
/// include:
///
/// - If a field's value performs an action when it is dropped.
/// - If a field's type does not implement an auto trait
/// (e.g. `Send`, `Sync`, `Unpin`).
///
/// For side-effects from dropping field values, this lint should
/// be allowed on those fields. For side-effects from containing
/// field types, `PhantomData` should be used.
pub DEAD_CODE,
Warn,
"detect unused, unexported items"
Expand Down

0 comments on commit e0cac76

Please sign in to comment.