Regression in issue 99684 fixed

This commit is contained in:
David Tolnay 2022-07-24 11:16:00 -07:00
parent f1ca69d245
commit 4d65048d41
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
2 changed files with 1 additions and 31 deletions

View file

@ -1,5 +1,4 @@
// FIXME: check-pass // check-pass
// check-fail
// edition:2021 // edition:2021
use std::fmt::{self, Display}; use std::fmt::{self, Display};
@ -30,9 +29,7 @@ impl<'a, T> Future for WriteFmtFuture<'a, T> {
async fn async_main() { async fn async_main() {
let _write = write!(&mut AsyncStdout, "...").await; let _write = write!(&mut AsyncStdout, "...").await;
//~^ ERROR temporary value dropped while borrowed
let _writeln = writeln!(&mut AsyncStdout, "...").await; let _writeln = writeln!(&mut AsyncStdout, "...").await;
//~^ ERROR temporary value dropped while borrowed
} }
fn main() { fn main() {

View file

@ -1,27 +0,0 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/format-args-temporaries-async.rs:32:30
|
LL | let _write = write!(&mut AsyncStdout, "...").await;
| ------------^^^^^^^^^^^--------
| | |
| | creates a temporary which is freed while still in use
| temporary value is freed at the end of this statement
| borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
error[E0716]: temporary value dropped while borrowed
--> $DIR/format-args-temporaries-async.rs:34:34
|
LL | let _writeln = writeln!(&mut AsyncStdout, "...").await;
| --------------^^^^^^^^^^^--------
| | |
| | creates a temporary which is freed while still in use
| temporary value is freed at the end of this statement
| borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0716`.