about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-20 03:23:23 +0000
committerMichael Goulet <michael@errs.io>2022-08-20 04:49:24 +0000
commitba7272959df7447c7393a14f475663de1f250f8f (patch)
tree240f16e6d26a169cf5b515a66127a1dac3a2756c /src/test
parente1b28cd2f16bd5b832183d7968cae3bb9213e78d (diff)
downloadrust-ba7272959df7447c7393a14f475663de1f250f8f.tar.gz
rust-ba7272959df7447c7393a14f475663de1f250f8f.zip
Use separate infcx to solve obligations during negative coherence
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs7
-rw-r--r--src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr (renamed from src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr)2
-rw-r--r--src/test/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr11
3 files changed, 18 insertions, 2 deletions
diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs
index 159788b1b77..221c1bc23b3 100644
--- a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs
+++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs
@@ -1,10 +1,15 @@
+// revisions: stock with_negative_coherence
 #![feature(negative_impls)]
+#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]
 
 // FIXME: this should compile
 
 trait MyPredicate<'a> {}
-impl<'a, T> !MyPredicate<'a> for &T where T: 'a {}
+
+impl<'a, T> !MyPredicate<'a> for &'a 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 `&_`
diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr
index 263bd19b424..097cc4e0fe3 100644
--- a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr
+++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_`
-  --> $DIR/coherence-negative-outlives-lifetimes.rs:9:1
+  --> $DIR/coherence-negative-outlives-lifetimes.rs:14:1
    |
 LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
    | ---------------------------------------------- first implementation here
diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr
new file mode 100644
index 00000000000..097cc4e0fe3
--- /dev/null
+++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_`
+  --> $DIR/coherence-negative-outlives-lifetimes.rs:14: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`.