-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not ICE when combining unsized locals and async
- Loading branch information
Showing
6 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// edition:2018 | ||
|
||
#![feature(unsized_locals)] | ||
#![feature(gen_future)] | ||
|
||
use std::future::poll_with_tls_context; | ||
use std::pin::Pin; | ||
use std::fmt::Display; | ||
|
||
async fn foo2() {} | ||
|
||
async fn foo(x: Box<dyn Display>) { //~ ERROR unsized values can't be used in `async` functions | ||
let x = *x; | ||
foo2().await; | ||
println!("hello {}", &x); | ||
} | ||
|
||
fn main() { | ||
let mut a = foo(Box::new(5)); | ||
let b = unsafe { | ||
Pin::new_unchecked(&mut a) | ||
}; | ||
match poll_with_tls_context(b) { | ||
_ => () | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error: unsized values can't be used in `async` functions | ||
--> $DIR/unsized-locals.rs:12:35 | ||
| | ||
LL | async fn foo(x: Box<dyn Display>) { | ||
| ___________________________________^ | ||
LL | | let x = *x; | ||
LL | | foo2().await; | ||
LL | | println!("hello {}", &x); | ||
LL | | } | ||
| |_^ contains unsized values | ||
|
||
error: aborting due to previous error | ||
|