-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually parse async gen blocks correctly
- Loading branch information
1 parent
27d8a57
commit 1d78ce6
Showing
5 changed files
with
87 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// compile-flags: --edition 2024 -Zunstable-options | ||
// check-pass | ||
|
||
#![feature(async_iterator, gen_blocks)] | ||
|
||
use std::async_iter::AsyncIterator; | ||
|
||
fn deduce() -> impl AsyncIterator<Item = ()> { | ||
async gen { | ||
yield Default::default(); | ||
} | ||
} | ||
|
||
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
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `gen` | ||
--> $DIR/feature-gate-gen_blocks.rs:12:11 | ||
| | ||
LL | async gen {}; | ||
| ^^^ expected one of 8 possible tokens | ||
|
||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `gen` | ||
--> $DIR/feature-gate-gen_blocks.rs:25:11 | ||
| | ||
LL | async gen {}; | ||
| ^^^ expected one of 8 possible tokens | ||
|
||
error[E0422]: cannot find struct, variant or union type `gen` in this scope | ||
--> $DIR/feature-gate-gen_blocks.rs:5:5 | ||
| | ||
LL | gen {}; | ||
| ^^^ not found in this scope | ||
|
||
error: aborting due to 1 previous error | ||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0422`. |
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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
// revisions: e2024 none | ||
//[e2024] compile-flags: --edition 2024 -Zunstable-options | ||
|
||
fn main() { | ||
fn test_gen() { | ||
gen {}; | ||
//[none]~^ ERROR: cannot find struct, variant or union type `gen` | ||
//[e2024]~^^ ERROR: gen blocks are experimental | ||
//[e2024]~| ERROR: type annotations needed | ||
} | ||
|
||
fn test_async_gen() { | ||
async gen {}; | ||
//[none]~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `gen` | ||
//[e2024]~^^ ERROR: gen blocks are experimental | ||
//[e2024]~| ERROR: type annotations needed | ||
} | ||
|
||
fn main() {} | ||
|
||
#[cfg(FALSE)] | ||
fn foo() { | ||
gen {}; | ||
//[e2024]~^ ERROR: gen blocks are experimental | ||
|
||
async gen {}; | ||
//[e2024]~^ ERROR: gen blocks are experimental | ||
//[none]~^^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `gen` | ||
} |