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 #1119

Merged
merged 1 commit into from
Feb 9, 2022
Merged

ices/84073.rs: fixed with errors #1119

merged 1 commit into from
Feb 9, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 9, 2022

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 merged commit 06c8426 into master Feb 9, 2022
@Alexendoo Alexendoo deleted the autofix/ices/84073.rs branch February 9, 2022 12:54
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