-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.F-negative_impls#![feature(negative_impls)]#![feature(negative_impls)]T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code:
#![feature(negative_impls)]
struct MyType;
impl !Clone for &mut MyType {}
fn main() {}
produces:
Compiling playground v0.0.1 (/playground)
error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `&mut MyType`:
--> src/main.rs:5:1
|
5 | impl !Clone for &mut MyType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> std::clone::Clone for &mut T
where T: ?Sized;
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
which reads as: any &mut T where T: ?Sized implements Clone
, which isn't realy true. It realy implements !Clone
.
Perhaps the error message should add a !
in front of the impl to make it more obvious, like this:
= note: conflicting implementation in crate `core`:
- impl<T> !std::clone::Clone for &mut T
where T: ?Sized;
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.F-negative_impls#![feature(negative_impls)]#![feature(negative_impls)]T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.