Static rustc_lint::builtin::MISSING_COPY_IMPLEMENTATIONS

source ·
Expand description

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


pub struct Foo {
    pub field: i32



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.