Skip to content

Commit 243ce35

Browse files
authored
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
2 parents 50417a5 + 35f9345 commit 243ce35

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// edition:2021
2+
// Check what happens when a const async fn is in the main function (#102796)
3+
4+
fn main() {
5+
const async fn a() {}
6+
//~^ ERROR functions cannot be both `const` and `async`
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: functions cannot be both `const` and `async`
2+
--> $DIR/const-async-fn-in-main.rs:5:5
3+
|
4+
LL | const async fn a() {}
5+
| ^^^^^-^^^^^----------
6+
| | |
7+
| | `async` because of this
8+
| `const` because of this
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)