Rollup merge of #77415 - ecstatic-morse:const-checking-async-block, r=oli-obk

Better error message for `async` blocks in a const-context

Improves the error message for the case in #77361.

r? @oli-obk
This commit is contained in:
Jonas Schievink 2020-10-02 20:27:08 +02:00 committed by GitHub
commit cac5352e33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 3 deletions

View file

@ -0,0 +1,8 @@
// From <https://github.com/rust-lang/rust/issues/77361>
// edition:2018
const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
//~^ `async` block
fn main() {}

View file

@ -0,0 +1,8 @@
error: `async` blocks are not allowed in constants
--> $DIR/async-block.rs:5:47
|
LL | const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
| ^^^^^^^^^^^
error: aborting due to previous error