-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE: Where clause ... was applicable to ... but now is not in compiler/rustc_trait_selection/src/traits/select/confirmation.rs
#126944
Comments
My attempt at minimizing and explaining what's going on: // Step 1: Create two names for a single type: `Thing` and `AlsoThing`
struct Thing;
struct Dummy;
pub trait DummyTrait {
type DummyType;
}
impl DummyTrait for Dummy {
type DummyType = Thing;
}
type AlsoThing = <Dummy as DummyTrait>::DummyType;
// Step 2: Create names for a single trait object type: `TraitObject` and `AlsoTraitObject`
pub trait SomeTrait {
type Item;
}
type TraitObject = dyn SomeTrait<Item = AlsoThing>;
type AlsoTraitObject = dyn SomeTrait<Item = Thing>;
// Step 3: Force the compiler to check whether the two names are the same type
pub trait Supertrait {
type Foo;
}
pub trait Subtrait: Supertrait<Foo = TraitObject> {}
pub trait HasOutput<A: ?Sized> {
type Output;
}
fn foo<F>() -> F::Output
where
F: HasOutput<dyn Subtrait<Foo = AlsoTraitObject>>,
{
todo!()
} Error output
|
errors with the new solver error[E0277]: the trait bound `F: HasOutput<(dyn Subtrait<Foo = (dyn SomeTrait<Item = Thing> + 'static)> + 'static)>` is not satisfied
--> <source>:35:1
|
35 | / {
36 | | todo!()
37 | | }
| |_^ the trait `HasOutput<(dyn Subtrait<Foo = (dyn SomeTrait<Item = Thing> + 'static)> + 'static)>` is not implemented for `F`
|
help: consider further restricting this bound
|
34 | F: HasOutput<dyn Subtrait<Foo = AlsoTraitObject>> + HasOutput<(dyn Subtrait<Foo = (dyn SomeTrait<Item = Thing> + 'static)> + 'static)>,
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.
<Compilation failed> |
I'd argue that next-solver doesn't fix this, since this code should compile. (Note that the code currently compiles if we replace the |
Looks to bisect to
|
I found a different ICE which has similar code ( #![allow(dead_code)]
// Step 1: Create two names for a single type: `Thing` and `AlsoThing`
struct Thing;
struct Dummy;
trait DummyTrait {
type DummyType;
}
impl DummyTrait for Dummy {
type DummyType = Thing;
}
type AlsoThing = <Dummy as DummyTrait>::DummyType;
// Step 2: Create two names for a single trait object type: `TraitObject` and `AlsoTraitObject`
trait SomeTrait<T> {}
type TraitObject = dyn SomeTrait<Thing>;
type AlsoTraitObject = dyn SomeTrait<AlsoThing>;
// Step 3: Force the compiler to check whether the two names are the same type
trait Supertrait {
type Foo: ?Sized;
fn do_thing(&self);
}
trait Subtrait: Supertrait<Foo = TraitObject> {}
fn foo(x: &dyn Subtrait<Foo = AlsoTraitObject>) {
x.do_thing();
} Error output
|
|
Code
(original code. over 100 lines)
Meta
rustc --version --verbose
:Error output
Output
Backtrace
The text was updated successfully, but these errors were encountered: