about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 18:28:36 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 19:08:11 +0200
commit8645ac4218e2c503c616ebcfccf034c07a94f405 (patch)
treee633d4ffd985a5a5e70a29114b5d81d305e7397e
parent73bde2f0ce38c57255840dd879ec10475ef44f2c (diff)
downloadrust-8645ac4218e2c503c616ebcfccf034c07a94f405.tar.gz
rust-8645ac4218e2c503c616ebcfccf034c07a94f405.zip
Revert "pre-expansion gate try_blocks"
This reverts commit 1935ba658c576f14397c2c7a26a6642cf08f26a6.
-rw-r--r--src/libsyntax/feature_gate/check.rs3
-rw-r--r--src/test/ui/feature-gates/feature-gate-try_blocks.rs7
-rw-r--r--src/test/ui/feature-gates/feature-gate-try_blocks.stderr4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs
index 1846ba5ed7b..52fb4761527 100644
--- a/src/libsyntax/feature_gate/check.rs
+++ b/src/libsyntax/feature_gate/check.rs
@@ -518,6 +518,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                                        "type ascription is experimental");
                 }
             }
+            ast::ExprKind::TryBlock(_) => {
+                gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
+            }
             ast::ExprKind::Block(_, opt_label) => {
                 if let Some(label) = opt_label {
                     gate_feature_post!(&self, label_break_value, label.ident.span,
diff --git a/src/test/ui/feature-gates/feature-gate-try_blocks.rs b/src/test/ui/feature-gates/feature-gate-try_blocks.rs
index b451ba84a15..06cadd82c07 100644
--- a/src/test/ui/feature-gates/feature-gate-try_blocks.rs
+++ b/src/test/ui/feature-gates/feature-gate-try_blocks.rs
@@ -1,12 +1,9 @@
 // compile-flags: --edition 2018
 
-#[cfg(FALSE)]
-fn foo() {
-    let try_result: Option<_> = try { //~ ERROR `try` blocks are unstable
+pub fn main() {
+    let try_result: Option<_> = try { //~ ERROR `try` expression is experimental
         let x = 5;
         x
     };
     assert_eq!(try_result, Some(5));
 }
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr
index 44a7d9b9043..565f3610a2e 100644
--- a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr
+++ b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr
@@ -1,5 +1,5 @@
-error[E0658]: `try` blocks are unstable
-  --> $DIR/feature-gate-try_blocks.rs:5:33
+error[E0658]: `try` expression is experimental
+  --> $DIR/feature-gate-try_blocks.rs:4:33
    |
 LL |       let try_result: Option<_> = try {
    |  _________________________________^