Skip to content

Commit

Permalink
Unrolled build for rust-lang#116178
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#116178 - Milo123459:milo/add-test-for-const-async-function-in-main, r=wesleywiser

Add test for `const async fn`

This adds a test for rust-lang#102796
  • Loading branch information
rust-timer committed Sep 27, 2023
2 parents 376f3f0 + 35f9345 commit f8e3947
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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

0 comments on commit f8e3947

Please sign in to comment.