Skip to content

The allow-by-default lint missing_copy_implementations does not honor !Copy impls #101980

Closed
@fmease

Description

@fmease

I would expect the following code to compile successfully since we explicitly opt out of implementing Copy:

#![feature(negative_impls)]
#![deny(missing_copy_implementations)]
#![crate_type = "lib"]

pub struct Struct {
    pub field: i32,
}

impl !Copy for Struct {}

However, the code fails to compile with the following error message:

error: type could implement `Copy`; consider adding `impl Copy`
 --> src/lib.rs:5:1
  |
5 | / pub struct Struct {
6 | |     pub field: i32,
7 | | }
  | |_^
  |
note: the lint level is defined here
 --> src/lib.rs:2:9
  |
2 | #![deny(missing_copy_implementations)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@rustbot label C-bug A-lint F-negative_impls

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-negative_impls#![feature(negative_impls)]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions