forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#130252 - compiler-errors:const-gen, r=chenyukang Properly report error on `const gen fn` Fixes rust-lang#130232 Also removes some (what I thought were unused) functions, and fixes a bug in clippy where we considered `gen fn` to be the same as `fn` because it was only built to consider asyncness.
- Loading branch information
Showing
7 changed files
with
66 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ edition:2024 | ||
//@ compile-flags: -Zunstable-options | ||
|
||
#![feature(gen_blocks)] | ||
|
||
const gen fn a() {} | ||
//~^ ERROR functions cannot be both `const` and `gen` | ||
|
||
const async gen fn b() {} | ||
//~^ ERROR functions cannot be both `const` and `async gen` | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: functions cannot be both `const` and `gen` | ||
--> $DIR/const_gen_fn.rs:6:1 | ||
| | ||
LL | const gen fn a() {} | ||
| ^^^^^-^^^---------- | ||
| | | | ||
| | `gen` because of this | ||
| `const` because of this | ||
|
||
error: functions cannot be both `const` and `async gen` | ||
--> $DIR/const_gen_fn.rs:9:1 | ||
| | ||
LL | const async gen fn b() {} | ||
| ^^^^^-^^^^^^^^^---------- | ||
| | | | ||
| | `async gen` because of this | ||
| `const` because of this | ||
|
||
error: aborting due to 2 previous errors | ||
|