-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fix negative overlap check regions #93652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 9 commits into
rust-lang:master
from
spastorino:fix-negative-overlap-check-regions
Feb 14, 2022
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4e83924
Remove extra negative_impl_exists check
spastorino 74c4318
Move FIXME text to the right place
spastorino b61e1bb
Add debug calls for negative impls in coherence
spastorino 3fd89a6
Properly check regions on negative overlap check
spastorino f4bb450
Call the method fork instead of clone and add proper comments
spastorino ff11dfd
Add failing test that should pass
spastorino 45983fe
Add comments about outlives_env
spastorino 8c4ffaa
Inline loose_check fn on call site
spastorino 3c7fa0b
reveal_defining_opaque_types field doesn't exist after rebase
spastorino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![crate_type = "lib"] | ||
#![feature(negative_impls)] | ||
#![feature(with_negative_coherence)] | ||
|
||
pub trait Error {} | ||
impl !Error for &str {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs
This file contains hidden or 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,12 @@ | ||
#![feature(negative_impls)] | ||
|
||
// FIXME: this should compile | ||
nikomatsakis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr
This file contains hidden or 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,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`. |
2 changes: 1 addition & 1 deletion
2
src/test/ui/coherence/coherence-overlap-negate-use-feature-gate.rs
This file contains hidden or 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// check-pass | ||
|
||
#![feature(negative_impls)] | ||
#![feature(with_negative_coherence)] | ||
|
||
use std::ops::DerefMut; | ||
|
||
|
This file contains hidden or 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
This file contains hidden or 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,16 @@ | ||
// check-pass | ||
|
||
#![feature(negative_impls)] | ||
#![feature(rustc_attrs)] | ||
#![feature(with_negative_coherence)] | ||
|
||
#[rustc_strict_coherence] | ||
trait Foo {} | ||
impl<T> !Foo for &T where T: 'static {} | ||
|
||
#[rustc_strict_coherence] | ||
trait Bar {} | ||
impl<T: Foo> Bar for T {} | ||
impl<T> Bar for &T where T: 'static {} | ||
|
||
fn main() {} |
This file contains hidden or 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![feature(negative_impls)] | ||
#![feature(with_negative_coherence)] | ||
|
||
pub trait ForeignTrait {} | ||
|
||
|
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.