about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/coroutine/gen_block.rs2
-rw-r--r--tests/ui/coroutine/gen_block_is_coro.rs2
-rw-r--r--tests/ui/coroutine/gen_block_is_iter.rs2
-rw-r--r--tests/ui/coroutine/gen_block_is_no_future.rs2
-rw-r--r--tests/ui/coroutine/gen_block_iterate.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.none.stderr (renamed from tests/ui/feature-gates/feature-gate-coroutines.stderr)19
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.rs12
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr28
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.rs15
11 files changed, 89 insertions, 13 deletions
diff --git a/tests/ui/coroutine/gen_block.rs b/tests/ui/coroutine/gen_block.rs
index fa502768236..c09fa2ae9be 100644
--- a/tests/ui/coroutine/gen_block.rs
+++ b/tests/ui/coroutine/gen_block.rs
@@ -1,6 +1,6 @@
 // revisions: e2024 none
 //[e2024] compile-flags: --edition 2024 -Zunstable-options
-#![cfg_attr(e2024, feature(coroutines))]
+#![cfg_attr(e2024, feature(gen_blocks))]
 
 fn main() {
     let x = gen {};
diff --git a/tests/ui/coroutine/gen_block_is_coro.rs b/tests/ui/coroutine/gen_block_is_coro.rs
index 814d5843a1b..c66ccefba85 100644
--- a/tests/ui/coroutine/gen_block_is_coro.rs
+++ b/tests/ui/coroutine/gen_block_is_coro.rs
@@ -1,5 +1,5 @@
 //compile-flags: --edition 2024 -Zunstable-options
-#![feature(coroutines, coroutine_trait)]
+#![feature(coroutines, coroutine_trait, gen_blocks)]
 
 use std::ops::Coroutine;
 
diff --git a/tests/ui/coroutine/gen_block_is_iter.rs b/tests/ui/coroutine/gen_block_is_iter.rs
index 16d5813c69d..92625cf7c28 100644
--- a/tests/ui/coroutine/gen_block_is_iter.rs
+++ b/tests/ui/coroutine/gen_block_is_iter.rs
@@ -2,7 +2,7 @@
 //compile-flags: --edition 2024 -Zunstable-options
 //[next] compile-flags: -Ztrait-solver=next
 // check-pass
-#![feature(coroutines)]
+#![feature(gen_blocks)]
 
 fn foo() -> impl Iterator<Item = u32> {
     gen { yield 42 }
diff --git a/tests/ui/coroutine/gen_block_is_no_future.rs b/tests/ui/coroutine/gen_block_is_no_future.rs
index 8927544a7b9..94766519738 100644
--- a/tests/ui/coroutine/gen_block_is_no_future.rs
+++ b/tests/ui/coroutine/gen_block_is_no_future.rs
@@ -1,5 +1,5 @@
 //compile-flags: --edition 2024 -Zunstable-options
-#![feature(coroutines)]
+#![feature(gen_blocks)]
 
 fn foo() -> impl std::future::Future { //~ ERROR is not a future
     gen { yield 42 }
diff --git a/tests/ui/coroutine/gen_block_iterate.rs b/tests/ui/coroutine/gen_block_iterate.rs
index 26932723779..04c44d58e52 100644
--- a/tests/ui/coroutine/gen_block_iterate.rs
+++ b/tests/ui/coroutine/gen_block_iterate.rs
@@ -2,7 +2,7 @@
 //compile-flags: --edition 2024 -Zunstable-options
 //[next] compile-flags: -Ztrait-solver=next
 // run-pass
-#![feature(coroutines)]
+#![feature(gen_blocks)]
 
 fn foo() -> impl Iterator<Item = u32> {
     gen { yield 42; for x in 3..6 { yield x } }
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
new file mode 100644
index 00000000000..595b42176b1
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
@@ -0,0 +1,9 @@
+error[E0627]: yield expression outside of coroutine literal
+  --> $DIR/feature-gate-coroutines.rs:5:5
+   |
+LL |     yield true;
+   |     ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.stderr b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr
index dd561643901..680bd1f2878 100644
--- a/tests/ui/feature-gates/feature-gate-coroutines.stderr
+++ b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr
@@ -1,5 +1,5 @@
 error[E0658]: yield syntax is experimental
-  --> $DIR/feature-gate-coroutines.rs:2:5
+  --> $DIR/feature-gate-coroutines.rs:5:5
    |
 LL |     yield true;
    |     ^^^^^^^^^^
@@ -8,7 +8,16 @@ LL |     yield true;
    = help: add `#![feature(coroutines)]` to the crate attributes to enable
 
 error[E0658]: yield syntax is experimental
-  --> $DIR/feature-gate-coroutines.rs:8:5
+  --> $DIR/feature-gate-coroutines.rs:8:16
+   |
+LL |     let _ = || yield true;
+   |                ^^^^^^^^^^
+   |
+   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+   = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+  --> $DIR/feature-gate-coroutines.rs:14:5
    |
 LL |     yield;
    |     ^^^^^
@@ -17,7 +26,7 @@ LL |     yield;
    = help: add `#![feature(coroutines)]` to the crate attributes to enable
 
 error[E0658]: yield syntax is experimental
-  --> $DIR/feature-gate-coroutines.rs:9:5
+  --> $DIR/feature-gate-coroutines.rs:15:5
    |
 LL |     yield 0;
    |     ^^^^^^^
@@ -26,12 +35,12 @@ LL |     yield 0;
    = help: add `#![feature(coroutines)]` to the crate attributes to enable
 
 error[E0627]: yield expression outside of coroutine literal
-  --> $DIR/feature-gate-coroutines.rs:2:5
+  --> $DIR/feature-gate-coroutines.rs:5:5
    |
 LL |     yield true;
    |     ^^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0627, E0658.
 For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.rs b/tests/ui/feature-gates/feature-gate-coroutines.rs
index c3c5aec8824..55243549175 100644
--- a/tests/ui/feature-gates/feature-gate-coroutines.rs
+++ b/tests/ui/feature-gates/feature-gate-coroutines.rs
@@ -1,10 +1,16 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
 fn main() {
-    yield true; //~ ERROR yield syntax is experimental
+    yield true; //[none]~ ERROR yield syntax is experimental
                 //~^ ERROR yield expression outside of coroutine literal
+
+    let _ = || yield true; //[none]~ ERROR yield syntax is experimental
 }
 
 #[cfg(FALSE)]
 fn foo() {
-    yield; //~ ERROR yield syntax is experimental
-    yield 0; //~ ERROR yield syntax is experimental
+    // Ok in 2024 edition
+    yield; //[none]~ ERROR yield syntax is experimental
+    yield 0; //[none]~ ERROR yield syntax is experimental
 }
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr
new file mode 100644
index 00000000000..1462c41e957
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr
@@ -0,0 +1,28 @@
+error[E0658]: gen blocks are experimental
+  --> $DIR/feature-gate-gen_blocks.rs:5:5
+   |
+LL |     gen {};
+   |     ^^^^^
+   |
+   = note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
+   = help: add `#![feature(gen_blocks)]` to the crate attributes to enable
+
+error[E0658]: gen blocks are experimental
+  --> $DIR/feature-gate-gen_blocks.rs:13:5
+   |
+LL |     gen {};
+   |     ^^^^^
+   |
+   = note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
+   = help: add `#![feature(gen_blocks)]` to the crate attributes to enable
+
+error[E0282]: type annotations needed
+  --> $DIR/feature-gate-gen_blocks.rs:5:9
+   |
+LL |     gen {};
+   |         ^^ cannot infer type
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0282, E0658.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr
new file mode 100644
index 00000000000..b448c35e846
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr
@@ -0,0 +1,9 @@
+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 previous error
+
+For more information about this error, try `rustc --explain E0422`.
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.rs b/tests/ui/feature-gates/feature-gate-gen_blocks.rs
new file mode 100644
index 00000000000..e2e1574a36a
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.rs
@@ -0,0 +1,15 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+fn main() {
+    gen {};
+    //[none]~^ ERROR: cannot find struct, variant or union type `gen`
+    //[e2024]~^^ ERROR: gen blocks are experimental
+    //[e2024]~| ERROR: type annotations needed
+}
+
+#[cfg(FALSE)]
+fn foo() {
+    gen {};
+    //[e2024]~^ ERROR: gen blocks are experimental
+}