Future compat warning with .await
ing a BoxFuture
· Issue #62312 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
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`