Skip to content

Commit ff11dfd

Browse files
committed
Add failing test that should pass
1 parent f4bb450 commit ff11dfd

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(negative_impls)]
2+
3+
// FIXME: this should compile
4+
5+
trait MyPredicate<'a> {}
6+
impl<'a, T> !MyPredicate<'a> for &T where T: 'a {}
7+
trait MyTrait<'a> {}
8+
impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
9+
impl<'a, T> MyTrait<'a> for &'a T {}
10+
//~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_`
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_`
2+
--> $DIR/coherence-negative-outlives-lifetimes.rs:9:1
3+
|
4+
LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
5+
| ---------------------------------------------- first implementation here
6+
LL | impl<'a, T> MyTrait<'a> for &'a T {}
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0119`.

0 commit comments

Comments
 (0)