Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/99945.rs: fixed with errors #1602

Merged
merged 1 commit into from
Jun 24, 2023
Merged

ices/99945.rs: fixed with errors #1602

merged 1 commit into from
Jun 24, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#99945

#![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)
}

fn main() {
    new_stateful_widget(|_| ()).make_state();
}
=== stdout ===
=== stderr ===
error[E0792]: expected generic lifetime parameter, found `'a`
  --> /home/runner/work/glacier/glacier/ices/99945.rs:26:5
   |
17 | type StateWidget<'a> = impl Widget<&'a ()>;
   |                  -- this generic parameter must be used with a generic lifetime parameter
...
26 |     StatefulWidget(build)
   |     ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0792`.
==============

=== stdout ===
=== stderr ===
error[E0792]: expected generic lifetime parameter, found `'a`
  --> /home/runner/work/glacier/glacier/ices/99945.rs:26:5
   |
17 | type StateWidget<'a> = impl Widget<&'a ()>;
   |                  -- this generic parameter must be used with a generic lifetime parameter
...
26 |     StatefulWidget(build)
   |     ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0792`.
==============
@JohnTitor JohnTitor merged commit 68f1272 into master Jun 24, 2023
@JohnTitor JohnTitor deleted the autofix/ices/99945.rs branch June 24, 2023 05:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants