Rollup merge of #116178 - Milo123459:milo/add-test-for-const-async-function-in-main, r=wesleywiser

Add test for `const async fn`

This adds a test for #102796
This commit is contained in:
Matthias Krüger 2023-09-27 10:42:35 +02:00 committed by GitHub
commit 243ce35b9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,7 @@
// edition:2021
// Check what happens when a const async fn is in the main function (#102796)
fn main() {
const async fn a() {}
//~^ ERROR functions cannot be both `const` and `async`
}

View File

@ -0,0 +1,11 @@
error: functions cannot be both `const` and `async`
--> $DIR/const-async-fn-in-main.rs:5:5
|
LL | const async fn a() {}
| ^^^^^-^^^^^----------
| | |
| | `async` because of this
| `const` because of this
error: aborting due to previous error