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

ices/90409-2.rs: fixed with errors #1351

Merged
merged 1 commit into from
Jul 20, 2022
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#90409

#![feature(type_alias_impl_trait)]
#![crate_type = "lib"]

use std::future::Future;

trait Bar {
    fn bar(&self);
}

type FooFuture<B> = impl Future<Output = ()>;

fn foo<B: Bar>(bar: B) -> FooFuture<B> {
    async move { bar.bar() }
}

pub fn mainish(ctx: &mut std::task::Context) {
    let boom: FooFuture<u32> = unsafe { core::mem::zeroed() };
    Box::pin(boom).as_mut().poll(ctx);
}
=== stdout ===
=== stderr ===
error[E0277]: the trait bound `B: Bar` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/90409-2.rs:13:5
   |
13 |     async move { bar.bar() }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B`
   |
note: required by a bound in `foo`
  --> /home/runner/work/glacier/glacier/ices/90409-2.rs:12:11
   |
12 | fn foo<B: Bar>(bar: B) -> FooFuture<B> {
   |           ^^^ required by this bound in `foo`
help: consider restricting type parameter `B`
   |
10 | type FooFuture<B: Bar> = impl Future<Output = ()>;
   |                 +++++

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0277]: the trait bound `B: Bar` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/90409-2.rs:13:5
   |
13 |     async move { bar.bar() }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B`
   |
note: required by a bound in `foo`
  --> /home/runner/work/glacier/glacier/ices/90409-2.rs:12:11
   |
12 | fn foo<B: Bar>(bar: B) -> FooFuture<B> {
   |           ^^^ required by this bound in `foo`
help: consider restricting type parameter `B`
   |
10 | type FooFuture<B: Bar> = impl Future<Output = ()>;
   |                 +++++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit e8a4360 into master Jul 20, 2022
@JohnTitor JohnTitor deleted the autofix/ices/90409-2.rs branch July 20, 2022 04:02
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.

2 participants