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

ices/98604.sh: fixed with errors #1335

Merged
merged 1 commit into from
Jul 9, 2022
Merged

ices/98604.sh: fixed with errors #1335

merged 1 commit into from
Jul 9, 2022

Conversation

github-actions[bot]
Copy link
Contributor

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

Issue: rust-lang/rust#98604

#!/bin/bash

rustc --edition=2021 - <<'EOF'

type AsyncFnPtr = Box<
    dyn Fn() -> std::pin::Pin<Box<dyn std::future::Future<Output = ()>>>,
>;

async fn test() {}

#[allow(unused_must_use)]
fn main() {
    Box::new(test) as AsyncFnPtr;
}

EOF

=== stdout ===
=== stderr ===
error[E0271]: type mismatch resolving `<fn() -> impl Future<Output = ()> {test} as FnOnce<()>>::Output == Pin<Box<(dyn Future<Output = ()> + 'static)>>`
  --> <anon>:10:5
   |
10 |     Box::new(test) as AsyncFnPtr;
   |     ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
   |
note: while checking the return type of the `async fn`
  --> <anon>:6:17
   |
6  | async fn test() {}
   |                 ^ checked the `Output` of this `async fn`, found opaque type
   = note:   expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
           found opaque type `impl Future<Output = ()>`
   = note: required for the cast from `fn() -> impl Future<Output = ()> {test}` to the object type `dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>>`

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0271]: type mismatch resolving `<fn() -> impl Future<Output = ()> {test} as FnOnce<()>>::Output == Pin<Box<(dyn Future<Output = ()> + 'static)>>`
  --> <anon>:10:5
   |
10 |     Box::new(test) as AsyncFnPtr;
   |     ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
   |
note: while checking the return type of the `async fn`
  --> <anon>:6:17
   |
6  | async fn test() {}
   |                 ^ checked the `Output` of this `async fn`, found opaque type
   = note:   expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
           found opaque type `impl Future<Output = ()>`
   = note: required for the cast from `fn() -> impl Future<Output = ()> {test}` to the object type `dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0271`.
==============
@JohnTitor JohnTitor merged commit 36de9e6 into master Jul 9, 2022
@JohnTitor JohnTitor deleted the autofix/ices/98604.sh branch July 9, 2022 03:43
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