parent
c3b05c6e5b
commit
12e362989b
@ -0,0 +1,36 @@
|
||||
// issue: rust-lang/rust#99945
|
||||
// ICE Failed to normalize
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait Widget<E> {
|
||||
type State;
|
||||
|
||||
fn make_state(&self) -> Self::State;
|
||||
}
|
||||
|
||||
impl<E> Widget<E> for () {
|
||||
type State = ();
|
||||
|
||||
fn make_state(&self) -> Self::State {}
|
||||
}
|
||||
|
||||
struct StatefulWidget<F>(F);
|
||||
|
||||
type StateWidget<'a> = impl Widget<&'a ()>;
|
||||
|
||||
impl<F: for<'a> Fn(&'a ()) -> StateWidget<'a>> Widget<()> for StatefulWidget<F> {
|
||||
type State = ();
|
||||
|
||||
fn make_state(&self) -> Self::State {}
|
||||
}
|
||||
|
||||
fn new_stateful_widget<F: for<'a> Fn(&'a ()) -> StateWidget<'a>>(build: F) -> impl Widget<()> {
|
||||
StatefulWidget(build)
|
||||
//~^ ERROR expected generic lifetime parameter, found `'a`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
new_stateful_widget(|_| ()).make_state();
|
||||
//~^ ERROR mismatched types
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/failed-to-normalize-ice-99945.rs:34:29
|
||||
|
|
||||
LL | type StateWidget<'a> = impl Widget<&'a ()>;
|
||||
| ------------------- the expected opaque type
|
||||
...
|
||||
LL | new_stateful_widget(|_| ()).make_state();
|
||||
| ^^ expected opaque type, found `()`
|
||||
|
|
||||
= note: expected opaque type `StateWidget<'_>`
|
||||
found unit type `()`
|
||||
|
||||
error[E0792]: expected generic lifetime parameter, found `'a`
|
||||
--> $DIR/failed-to-normalize-ice-99945.rs:29:5
|
||||
|
|
||||
LL | type StateWidget<'a> = impl Widget<&'a ()>;
|
||||
| -- this generic parameter must be used with a generic lifetime parameter
|
||||
...
|
||||
LL | StatefulWidget(build)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0792.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user