forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) conflicting negative impl marker and add tests
- Loading branch information
Showing
4 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![feature(negative_impls)] | ||
//@ edition: 2021 | ||
// Test to ensure we are printing the polarity of the impl trait ref | ||
// when printing out conflicting trait impls | ||
|
||
struct MyType; | ||
|
||
impl !Clone for &mut MyType {} | ||
//~^ ERROR conflicting implementations of trait `Clone` for type `&mut MyType` | ||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0119]: conflicting implementations of trait `Clone` for type `&mut MyType` | ||
--> $DIR/coherence-conflicting-repeated-negative-trait-impl-70849.rs:8:1 | ||
| | ||
LL | impl !Clone for &mut MyType {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: conflicting implementation in crate `core`: | ||
- impl<T> !Clone for &mut T | ||
where T: ?Sized; | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |