mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #121899 - shepmaster:dead-code-docs, r=wesleywiser
Document how removing a type's field can be bad and what to do instead Related to #119645
This commit is contained in:
commit
7a744af83e
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user