mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Document how removing a type's field can be bad and what to do instead
Related to #119645
This commit is contained in:
parent
3314d5ce4c
commit
71080dd1d4
@ -702,6 +702,20 @@ declare_lint! {
|
|||||||
/// `PhantomData`.
|
/// `PhantomData`.
|
||||||
///
|
///
|
||||||
/// Otherwise consider removing the unused code.
|
/// 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,
|
pub DEAD_CODE,
|
||||||
Warn,
|
Warn,
|
||||||
"detect unused, unexported items"
|
"detect unused, unexported items"
|
||||||
|
Loading…
Reference in New Issue
Block a user