-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Implement stable overlap check considering negative traits #93175
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 12 commits into
rust-lang:master
from
spastorino:negative-traits-coherence-new
Jan 25, 2022
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f518827
Use impl1 and impl2 instead of a and b prefixes
spastorino 052b31b
Move auxiliary fns out of overlap_with_probe
spastorino b2a45f0
Extract stable_disjoint fn
spastorino c2890ed
Add overlap mode
spastorino d2d25a5
Implement stable with negative coherence mode
spastorino 1ec962f
Do not pass OverlapMode down, just create a closure to properly set t…
spastorino 19e3c86
Make strict_disjoint use explicit_disjoint
spastorino e2567b0
Remove intermediate function doesn't make more sense
spastorino e5f2fdb
Restructure the code leveraging in abilities more than modes
spastorino 7847ca8
Document OverlapMode
spastorino 2693832
Rename strict_check to negative_impl_exists
spastorino 8189bac
FIXME include regions too
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![crate_type = "lib"] | ||
#![feature(negative_impls)] | ||
#![feature(rustc_attrs)] | ||
|
||
pub trait Future {} | ||
|
||
#[rustc_with_negative_coherence] | ||
impl<E> !Future for Option<E> where E: Sized {} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/coherence/coherence-overlap-negative-trait2.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,18 @@ | ||
// check-pass | ||
// aux-build:option_future.rs | ||
// | ||
// Check that if we promise to not impl what would overlap it doesn't actually overlap | ||
|
||
#![feature(rustc_attrs)] | ||
|
||
extern crate option_future as lib; | ||
use lib::Future; | ||
|
||
trait Termination {} | ||
|
||
#[rustc_with_negative_coherence] | ||
impl<E> Termination for Option<E> where E: Sized {} | ||
#[rustc_with_negative_coherence] | ||
impl<F> Termination for F where F: Future + Sized {} | ||
|
||
fn main() {} |
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.