about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/util/parser.rs
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2022-03-25 23:43:54 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2022-04-30 17:40:27 -0700
commite094ee5f102dfea8e99137d3818510cd178e8817 (patch)
tree1355dfd0fa0c410199d17a4ea5f8889703a661db /compiler/rustc_ast/src/util/parser.rs
parent2c858a7c3f189eb11ad89d9bf9f2e87cac9d2b76 (diff)
downloadrust-e094ee5f102dfea8e99137d3818510cd178e8817.tar.gz
rust-e094ee5f102dfea8e99137d3818510cd178e8817.zip
Add `do yeet` expressions to allow experimentation in nightly
Using an obviously-placeholder syntax.  An RFC would still be needed before this could have any chance at stabilization, and it might be removed at any point.

But I'd really like to have it in nightly at least to ensure it works well with try_trait_v2, especially as we refactor the traits.
Diffstat (limited to 'compiler/rustc_ast/src/util/parser.rs')
-rw-r--r--compiler/rustc_ast/src/util/parser.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/util/parser.rs b/compiler/rustc_ast/src/util/parser.rs
index 742a7d1d2df..74b7fe9e249 100644
--- a/compiler/rustc_ast/src/util/parser.rs
+++ b/compiler/rustc_ast/src/util/parser.rs
@@ -247,6 +247,7 @@ pub enum ExprPrecedence {
     Continue,
     Ret,
     Yield,
+    Yeet,
 
     Range,
 
@@ -299,7 +300,8 @@ impl ExprPrecedence {
             ExprPrecedence::Break |
             ExprPrecedence::Continue |
             ExprPrecedence::Ret |
-            ExprPrecedence::Yield => PREC_JUMP,
+            ExprPrecedence::Yield |
+            ExprPrecedence::Yeet => PREC_JUMP,
 
             // `Range` claims to have higher precedence than `Assign`, but `x .. x = x` fails to
             // parse, instead of parsing as `(x .. x) = x`.  Giving `Range` a lower precedence