Future compat warning with .awaiting a BoxFuture · Issue #62312 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@Centril

Description

@Centril

The code is the same as in #62284:

#![feature(async_await)]

use std::future::Future; use std::pin::Pin;

type BoxFuture = Pin<Box<dyn Future<Output = ()>>>;

async fn foo() -> BoxFuture { Box::pin(bar()) as _ }

async fn bar() { let _ = foo().await; }

This results in:

warning[E0381]: use of possibly uninitialized variable: `_`
  --> src/lib.rs:17:13
   |
17 |     let _ = foo().await;
   |             ^^^^^^^^^^^ use of possibly uninitialized value
   |
   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
   = note: for more information, try `rustc --explain E0729`