Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/ui/async-await/const-async-fn-in-main.rs
Original file line number Diff line number Diff line change
@@ -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`
}
11 changes: 11 additions & 0 deletions tests/ui/async-await/const-async-fn-in-main.stderr
Original file line number Diff line number Diff line change
@@ -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