rustc_lint::builtin

Static MISSING_COPY_IMPLEMENTATIONS

source
pub static MISSING_COPY_IMPLEMENTATIONS: &Lint
Expand description

The missing_copy_implementations lint detects potentially-forgotten implementations of Copy for public types.

§Example

#![deny(missing_copy_implementations)]
pub struct Foo {
    pub field: i32
}

{{produces}}

§Explanation

Historically (before 1.0), types were automatically marked as Copy if possible. This was changed so that it required an explicit opt-in by implementing the Copy trait. As part of this change, a lint was added to alert if a copyable type was not marked Copy.

This lint is “allow” by default because this code isn’t bad; it is common to write newtypes like this specifically so that a Copy type is no longer Copy. Copy types can result in unintended copies of large data which can impact performance.