about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 18:32:40 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 19:08:11 +0200
commit680089c2d906ac33e4ae16a184fce12b610af434 (patch)
tree5a23ea8f8263f5c9913daca88dcf4057155fe54f
parent4c48355c69148c49d1becc26dcc6439650a35589 (diff)
downloadrust-680089c2d906ac33e4ae16a184fce12b610af434.tar.gz
rust-680089c2d906ac33e4ae16a184fce12b610af434.zip
Revert "pre-expansion gate box_patterns"
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
-rw-r--r--src/libsyntax/feature_gate/check.rs15
-rw-r--r--src/test/ui/feature-gates/feature-gate-box_patterns.rs3
-rw-r--r--src/test/ui/feature-gates/feature-gate-box_patterns.stderr11
-rw-r--r--src/test/ui/or-patterns/or-patterns-syntactic-pass.rs1
-rw-r--r--src/test/ui/pattern/rest-pat-syntactic.rs2
5 files changed, 15 insertions, 17 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs
index 7c5b75387d2..33dfe386a4d 100644
--- a/src/libsyntax/feature_gate/check.rs
+++ b/src/libsyntax/feature_gate/check.rs
@@ -533,6 +533,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         visit::walk_expr(self, e)
     }
 
+    fn visit_arm(&mut self, arm: &'a ast::Arm) {
+        visit::walk_arm(self, arm)
+    }
+
     fn visit_pat(&mut self, pattern: &'a ast::Pat) {
         match &pattern.kind {
             PatKind::Slice(pats) => {
@@ -552,6 +556,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                     }
                 }
             }
+            PatKind::Box(..) => {
+                gate_feature_post!(&self, box_patterns,
+                                  pattern.span,
+                                  "box pattern syntax is experimental");
+            }
             PatKind::Range(_, _, Spanned { node: RangeEnd::Excluded, .. }) => {
                 gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
                                    "exclusive range pattern syntax is experimental");
@@ -561,7 +570,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         visit::walk_pat(self, pattern)
     }
 
-    fn visit_fn(&mut self, fn_kind: FnKind<'a>, fn_decl: &'a ast::FnDecl, span: Span, _: NodeId) {
+    fn visit_fn(&mut self,
+                fn_kind: FnKind<'a>,
+                fn_decl: &'a ast::FnDecl,
+                span: Span,
+                _node_id: NodeId) {
         if let Some(header) = fn_kind.header() {
             // Stability of const fn methods are covered in
             // `visit_trait_item` and `visit_impl_item` below; this is
diff --git a/src/test/ui/feature-gates/feature-gate-box_patterns.rs b/src/test/ui/feature-gates/feature-gate-box_patterns.rs
index c5b926d5af2..8bec16a974e 100644
--- a/src/test/ui/feature-gates/feature-gate-box_patterns.rs
+++ b/src/test/ui/feature-gates/feature-gate-box_patterns.rs
@@ -2,6 +2,3 @@ fn main() {
     let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
     println!("x: {}", x);
 }
-
-macro_rules! accept_pat { ($p:pat) => {} }
-accept_pat!(box 0); //~ ERROR box pattern syntax is experimental
diff --git a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr
index 1e47bd41e88..d2dafe93a86 100644
--- a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr
+++ b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr
@@ -7,15 +7,6 @@ LL |     let box x = Box::new('c');
    = note: for more information, see https://github.com/rust-lang/rust/issues/29641
    = help: add `#![feature(box_patterns)]` to the crate attributes to enable
 
-error[E0658]: box pattern syntax is experimental
-  --> $DIR/feature-gate-box_patterns.rs:7:13
-   |
-LL | accept_pat!(box 0);
-   |             ^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/29641
-   = help: add `#![feature(box_patterns)]` to the crate attributes to enable
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs
index 9667711242c..5fe72caf9c1 100644
--- a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs
+++ b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs
@@ -4,7 +4,6 @@
 // check-pass
 
 #![feature(or_patterns)]
-#![feature(box_patterns)]
 
 fn main() {}
 
diff --git a/src/test/ui/pattern/rest-pat-syntactic.rs b/src/test/ui/pattern/rest-pat-syntactic.rs
index 45b31f61253..9656a0b5de9 100644
--- a/src/test/ui/pattern/rest-pat-syntactic.rs
+++ b/src/test/ui/pattern/rest-pat-syntactic.rs
@@ -3,8 +3,6 @@
 
 // check-pass
 
-#![feature(box_patterns)]
-
 fn main() {}
 
 macro_rules! accept_pat {