about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-06-21 07:37:02 +0200
committerGitHub <noreply@github.com>2023-06-21 07:37:02 +0200
commitc6710d15f1228a5a3fda4c1aa307c3073ed83c9e (patch)
tree3bfcdc2ff050b834f4c58dde27d4b902dfa63afc /tests
parenta98c14f3a9326e00d4c0734138308bf98206baa6 (diff)
parentb967f5c30d69fd44933ace40598eae6dfdeaa6a4 (diff)
downloadrust-c6710d15f1228a5a3fda4c1aa307c3073ed83c9e.tar.gz
rust-c6710d15f1228a5a3fda4c1aa307c3073ed83c9e.zip
Rollup merge of #112790 - WaffleLapkin:syntactically, r=Nilstrieb
Syntactically accept `become` expressions (explicit tail calls experiment)

This adds `ast::ExprKind::Become`, implements parsing and properly gates the feature.

cc `@scottmcm`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs9
-rw-r--r--tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr21
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs
new file mode 100644
index 00000000000..856a7f39328
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs
@@ -0,0 +1,9 @@
+pub fn you<T>() -> T {
+    become bottom(); //~ error: `become` expression is experimental
+}
+
+pub fn bottom<T>() -> T {
+    become you(); //~ error: `become` expression is experimental
+}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr
new file mode 100644
index 00000000000..b58da19c174
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr
@@ -0,0 +1,21 @@
+error[E0658]: `become` expression is experimental
+  --> $DIR/feature-gate-explicit_tail_calls.rs:2:5
+   |
+LL |     become bottom();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information
+   = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable
+
+error[E0658]: `become` expression is experimental
+  --> $DIR/feature-gate-explicit_tail_calls.rs:6:5
+   |
+LL |     become you();
+   |     ^^^^^^^^^^^^
+   |
+   = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information
+   = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.