forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.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,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 | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/ui/type-alias-impl-trait/failed-to-normalize-ice-99945.stderr
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,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`. |