diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-02-10 11:55:23 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-02-14 12:57:22 -0300 |
| commit | ff11dfd71d900a05033f3c1b126a792e02a032fb (patch) | |
| tree | f92200beb110f0199a0d3bc1d195ccc6c35ff857 | |
| parent | f4bb4500ddb4a54b5c33908861e821317c589850 (diff) | |
| download | rust-ff11dfd71d900a05033f3c1b126a792e02a032fb.tar.gz rust-ff11dfd71d900a05033f3c1b126a792e02a032fb.zip | |
Add failing test that should pass
| -rw-r--r-- | src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs new file mode 100644 index 00000000000..159788b1b77 --- /dev/null +++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs @@ -0,0 +1,12 @@ +#![feature(negative_impls)] + +// FIXME: this should compile + +trait MyPredicate<'a> {} +impl<'a, T> !MyPredicate<'a> for &T where T: 'a {} +trait MyTrait<'a> {} +impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {} +impl<'a, T> MyTrait<'a> for &'a T {} +//~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_` + +fn main() {} diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr new file mode 100644 index 00000000000..263bd19b424 --- /dev/null +++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_` + --> $DIR/coherence-negative-outlives-lifetimes.rs:9:1 + | +LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {} + | ---------------------------------------------- first implementation here +LL | impl<'a, T> MyTrait<'a> for &'a T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. |
