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

ices/84073.rs: fixed with errors #1196

Closed
wants to merge 1 commit into from
Closed

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#84073

use std::marker::PhantomData;

pub trait StatefulFuture<S> {}
pub struct Never<T>(PhantomData<T>);
impl<T> StatefulFuture<T> for Never<T> {}

pub struct RaceBuilder<F, S> {
    future: F,
    _phantom: PhantomData<S>,
}

impl<T, F> RaceBuilder<T, F>
where
    F: StatefulFuture<Option<T>>,
{
    pub fn when(self) {}
}

pub struct Race<T, R> {
    race: R,
    _phantom: PhantomData<T>,
}

impl<T, R> Race<T, R>
where
    R: Fn(RaceBuilder<T, Never<T>>),
{
    pub fn new(race: R) {}
}

fn main() {
    Race::new(|race| race.when());
}
=== stdout ===
=== stderr ===
error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
  --> /home/runner/work/glacier/glacier/ices/84073.rs:32:16
   |
32 |     Race::new(|race| race.when());
   |                ^^^^ consider giving this closure parameter the explicit type `RaceBuilder<T, Never<T>>`, where the type parameter `T` is specified

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
  --> /home/runner/work/glacier/glacier/ices/84073.rs:32:16
   |
32 |     Race::new(|race| race.when());
   |                ^^^^ consider giving this closure parameter the explicit type `RaceBuilder<T, Never<T>>`, where the type parameter `T` is specified

error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.
==============
@Alexendoo Alexendoo closed this in 1714f42 Mar 31, 2022
@Alexendoo Alexendoo deleted the autofix/ices/84073.rs branch March 31, 2022 21:53
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

1 participant