Skip to content

Commit

Permalink
coherence doesn't like region constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Oct 23, 2023
1 parent 1d99ddb commit e1edefc
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: stock with_negative_coherence
//[with_negative_coherence] check-pass
//[with_negative_coherence] known-bug: unknown

#![feature(negative_impls)]
#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 1 addition & 1 deletion tests/ui/coherence/coherence-overlap-with-regions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// check-pass
// known-bug: unknown

#![feature(negative_impls)]
#![feature(rustc_attrs)]
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/coherence/coherence-overlap-with-regions.stderr
Original file line number Diff line number Diff line change
@@ -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`.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// revisions: any_lt static_lt
//[static_lt] check-pass
//[static_lt] known-bug: unknown

#![feature(negative_impls)]
#![feature(with_negative_coherence)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit e1edefc

Please sign in to comment.