You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#132668 - ehuss:yield-gate-2024, r=davidtwco
Feature gate yield expressions not in 2024
This changes it so that yield expressions are no longer allowed in the 2024 edition without a feature gate. We are currently only reserving the `gen` keyword in the 2024 edition, and not allowing anything else to be implicitly enabled by the edition.
In practice this doesn't have a significant difference since yield expressions can't really be used outside of coroutines or gen blocks, which have their own feature gates. However, it does affect what is accepted pre-expansion, and I would feel more comfortable not allowing yield expressions.
I believe the stabilization process for gen blocks or coroutines will not need to check the edition here, so this shouldn't ever be needed.
Copy file name to clipboardexpand all lines: tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
+41-1
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,46 @@ LL | yield true;
8
8
= help: add `#![feature(coroutines)]` to the crate attributes to enable
9
9
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
10
11
+
error[E0658]: yield syntax is experimental
12
+
--> $DIR/feature-gate-coroutines.rs:10:16
13
+
|
14
+
LL | let _ = || yield true;
15
+
| ^^^^^^^^^^
16
+
|
17
+
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
18
+
= help: add `#![feature(coroutines)]` to the crate attributes to enable
19
+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20
+
21
+
error[E0658]: yield syntax is experimental
22
+
--> $DIR/feature-gate-coroutines.rs:18:5
23
+
|
24
+
LL | yield;
25
+
| ^^^^^
26
+
|
27
+
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
28
+
= help: add `#![feature(coroutines)]` to the crate attributes to enable
29
+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30
+
31
+
error[E0658]: yield syntax is experimental
32
+
--> $DIR/feature-gate-coroutines.rs:19:5
33
+
|
34
+
LL | yield 0;
35
+
| ^^^^^^^
36
+
|
37
+
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
38
+
= help: add `#![feature(coroutines)]` to the crate attributes to enable
39
+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40
+
41
+
error[E0658]: yield syntax is experimental
42
+
--> $DIR/feature-gate-coroutines.rs:5:5
43
+
|
44
+
LL | yield true;
45
+
| ^^^^^^^^^^
46
+
|
47
+
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
48
+
= help: add `#![feature(coroutines)]` to the crate attributes to enable
49
+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
50
+
11
51
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
0 commit comments