-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore but do not assume region obligations from unifying headers in …
…negative coherence
- Loading branch information
1 parent
0ea7ddc
commit d688b86
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...oherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error: conflicting implementations of trait `FnMarker` for type `fn(&_)` | ||
--> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:21:1 | ||
| | ||
LL | impl<T: ?Sized + Marker> FnMarker for fn(T) {} | ||
| ------------------------------------------- first implementation here | ||
LL | impl<T: ?Sized> FnMarker for fn(&T) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&_)` | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> | ||
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details | ||
note: the lint level is defined here | ||
--> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:4:11 | ||
| | ||
LL | #![forbid(coherence_leak_check)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
25 changes: 25 additions & 0 deletions
25
tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// revisions: explicit implicit | ||
//[implicit] check-pass | ||
|
||
#![forbid(coherence_leak_check)] | ||
#![feature(negative_impls, with_negative_coherence)] | ||
|
||
pub trait Marker {} | ||
|
||
#[cfg(implicit)] | ||
impl<T: ?Sized> !Marker for &T {} | ||
|
||
#[cfg(explicit)] | ||
impl<'a, T: ?Sized + 'a> !Marker for &'a T {} | ||
|
||
trait FnMarker {} | ||
|
||
// Unifying these two impls below results in a `T: '!0` obligation | ||
// that we shouldn't need to care about. Ideally, we'd treat that | ||
// as an assumption when proving `&'!0 T: Marker`... | ||
impl<T: ?Sized + Marker> FnMarker for fn(T) {} | ||
impl<T: ?Sized> FnMarker for fn(&T) {} | ||
//[explicit]~^ ERROR conflicting implementations of trait `FnMarker` for type `fn(&_)` | ||
//[explicit]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
|
||
fn main() {} |