coherence doesn't like region constraints

This commit is contained in:
Michael Goulet 2023-08-02 02:06:55 +00:00
parent 1d99ddbfe8
commit e1edefc137
6 changed files with 37 additions and 3 deletions

View File

@ -1,5 +1,5 @@
// revisions: stock with_negative_coherence // revisions: stock with_negative_coherence
//[with_negative_coherence] check-pass //[with_negative_coherence] known-bug: unknown
#![feature(negative_impls)] #![feature(negative_impls)]
#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))] #![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]

View File

@ -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`.

View File

@ -1,4 +1,4 @@
// check-pass // known-bug: unknown
#![feature(negative_impls)] #![feature(negative_impls)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]

View File

@ -0,0 +1,11 @@
error[E0119]: conflicting implementations of trait `Bar` for type `&_`
--> $DIR/coherence-overlap-with-regions.rs:20:1
|
LL | impl<T: Foo> Bar for T {}
| ---------------------- first implementation here
LL | impl<T> Bar for &T where T: 'static {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,5 +1,5 @@
// revisions: any_lt static_lt // revisions: any_lt static_lt
//[static_lt] check-pass //[static_lt] known-bug: unknown
#![feature(negative_impls)] #![feature(negative_impls)]
#![feature(with_negative_coherence)] #![feature(with_negative_coherence)]

View File

@ -0,0 +1,12 @@
error[E0119]: conflicting implementations of trait `Bar` for type `&'static _`
--> $DIR/negative-coherence-considering-regions.rs:26:1
|
LL | impl<T> Bar for T where T: Foo {}
| ------------------------------ first implementation here
...
LL | impl<T> Bar for &'static T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&'static _`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.