MISSING_COPY_IMPLEMENTATIONS in rustc_lint::builtin - Rust
Description: The `missing_copy_implementations` lint detects potentially-forgotten implementations of `Copy` for public types.

Skip to main content

## MISSING_COPY_IMPLEMENTATIONS

# 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.