-
Notifications
You must be signed in to change notification settings - Fork 13.4k
change equate for binders to not rely on subtyping #118247
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
error[E0119]: conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` | ||
--> $DIR/coherence-fn-covariant-bound-vs-static.rs:17:1 | ||
warning: conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` | ||
--> $DIR/coherence-fn-covariant-bound-vs-static.rs:22:1 | ||
| | ||
LL | impl Trait for for<'r> fn(fn(&'r ())) {} | ||
| ------------------------------------- first implementation here | ||
LL | impl<'a> Trait for fn(fn(&'a ())) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'r> fn(fn(&'r ()))` | ||
| | ||
= warning: the behavior may change 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: `#[warn(coherence_leak_check)]` on by default | ||
|
||
error: aborting due to 1 previous error | ||
warning: 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
error[E0119]: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` | ||
--> $DIR/coherence-fn-inputs.rs:15:1 | ||
warning: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` | ||
--> $DIR/coherence-fn-inputs.rs:16:1 | ||
| | ||
LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} | ||
| ----------------------------------------------- first implementation here | ||
LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u32, &'b u32)` | ||
| | ||
= warning: the behavior may change 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: `#[warn(coherence_leak_check)]` on by default | ||
|
||
error: aborting due to 1 previous error | ||
warning: 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,21 @@ LL | WHAT_A_TYPE => 0, | |
= note: the traits must be derived, manual `impl`s are not sufficient | ||
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details | ||
|
||
error: aborting due to 1 previous error | ||
error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @spastorino sorry to necro this PR, but this test is (even still on master today) labeled as known-bug and those should have been removed.(at least for 97156, not sure what's going on with the other)... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
--> $DIR/typeid-equality-by-subtyping.rs:44:51 | ||
| | ||
LL | fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` | ||
|
||
error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied | ||
--> $DIR/typeid-equality-by-subtyping.rs:47:1 | ||
| | ||
LL | / { | ||
LL | | let x: <Two as WithAssoc<T>>::Assoc = generic::<One, T>(x); | ||
LL | | x | ||
LL | | } | ||
| |_^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// A regression test for #97156 | ||
|
||
type One = for<'a> fn(&'a (), &'a ()); | ||
spastorino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type Two = for<'a, 'b> fn(&'a (), &'b ()); | ||
|
||
mod my_api { | ||
use std::any::Any; | ||
use std::marker::PhantomData; | ||
|
||
pub struct Foo<T: 'static> { | ||
a: &'static dyn Any, | ||
_p: PhantomData<*mut T>, // invariant, the type of the `dyn Any` | ||
} | ||
|
||
impl<T: 'static> Foo<T> { | ||
pub fn deref(&self) -> &'static T { | ||
match self.a.downcast_ref::<T>() { | ||
None => unsafe { std::hint::unreachable_unchecked() }, | ||
Some(a) => a, | ||
} | ||
} | ||
|
||
pub fn new(a: T) -> Foo<T> { | ||
Foo::<T> { a: Box::leak(Box::new(a)), _p: PhantomData } | ||
} | ||
} | ||
} | ||
|
||
use my_api::*; | ||
|
||
fn main() { | ||
let foo = Foo::<One>::new((|_, _| ()) as One); | ||
foo.deref(); | ||
let foo: Foo<Two> = foo; | ||
//~^ ERROR mismatched types [E0308] | ||
//~| ERROR mismatched types [E0308] | ||
foo.deref(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/higher-ranked-lifetime-equality.rs:34:25 | ||
| | ||
LL | let foo: Foo<Two> = foo; | ||
| ^^^ one type is more general than the other | ||
| | ||
= note: expected struct `my_api::Foo<for<'a, 'b> fn(&'a (), &'b ())>` | ||
found struct `my_api::Foo<for<'a> fn(&'a (), &'a ())>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/higher-ranked-lifetime-equality.rs:34:25 | ||
| | ||
LL | let foo: Foo<Two> = foo; | ||
| ^^^ one type is more general than the other | ||
| | ||
= note: expected struct `my_api::Foo<for<'a, 'b> fn(&'a (), &'b ())>` | ||
found struct `my_api::Foo<for<'a> fn(&'a (), &'a ())>` | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: implementation of `Trait` is not general enough | ||
--> $DIR/hrtb-exists-forall-trait-covariant.rs:33:5 | ||
| | ||
LL | foo::<()>(); | ||
| ^^^^^^^^^^^ implementation of `Trait` is not general enough | ||
| | ||
= note: `()` must implement `Trait<for<'b> fn(fn(&'b u32))>` | ||
= note: ...but it actually implements `Trait<fn(fn(&'0 u32))>`, for some specific lifetime `'0` | ||
|
||
error: aborting due to 1 previous error | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error[E0308]: `match` arms have incompatible types | ||
--> $DIR/old-lub-glb-hr-eq.rs:13:14 | ||
| | ||
LL | let z = match 22 { | ||
| _____________- | ||
LL | | 0 => x, | ||
| | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8)` | ||
LL | | _ => y, | ||
| | ^ one type is more general than the other | ||
LL | | | ||
LL | | }; | ||
| |_____- `match` arms have incompatible types | ||
| | ||
= note: expected fn pointer `for<'a, 'b> fn(&'a _, &'b _)` | ||
found fn pointer `for<'a> fn(&'a _, &'a _)` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/hr-fn-aau-eq-abu.rs:18:53 | ||
| | ||
LL | let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa(); | ||
| ^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected struct `Cell<for<'a, 'b> fn(&'a _, &'b _)>` | ||
found struct `Cell<for<'a> fn(&'a _, &'a _)>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/hr-fn-aau-eq-abu.rs:18:53 | ||
| | ||
LL | let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa(); | ||
| ^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected struct `Cell<for<'a, 'b> fn(&'a _, &'b _)>` | ||
found struct `Cell<for<'a> fn(&'a _, &'a _)>` | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: the type `<for<'a, 'b> fn(&'a u8, &'b u8) as Trait>::Ty` is not well-formed | ||
--> $DIR/member-constraints-in-root-universe.rs:12:16 | ||
| | ||
LL | fn test<'a>(_: <fn(&u8, &u8) as Trait>::Ty) -> impl Sized { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
Uh oh!
There was an error while loading. Please reload this page.