-
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.
Rollup merge of #93175 - spastorino:negative-traits-coherence-new, r=…
…nikomatsakis Implement stable overlap check considering negative traits This PR implement the new disjointness rules for overlap check described in https://rust-lang.github.io/negative-impls-initiative/explainer/coherence-check.html#new-disjointness-rules r? ``@nikomatsakis``
- Loading branch information
Showing
5 changed files
with
229 additions
and
61 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
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
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
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,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 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() {} |