Skip to content

Commit 680089c

Browse files
committed
Revert "pre-expansion gate box_patterns"
This reverts commit 2aff6b3.
1 parent 4c48355 commit 680089c

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

src/libsyntax/feature_gate/check.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
533533
visit::walk_expr(self, e)
534534
}
535535

536+
fn visit_arm(&mut self, arm: &'a ast::Arm) {
537+
visit::walk_arm(self, arm)
538+
}
539+
536540
fn visit_pat(&mut self, pattern: &'a ast::Pat) {
537541
match &pattern.kind {
538542
PatKind::Slice(pats) => {
@@ -552,6 +556,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
552556
}
553557
}
554558
}
559+
PatKind::Box(..) => {
560+
gate_feature_post!(&self, box_patterns,
561+
pattern.span,
562+
"box pattern syntax is experimental");
563+
}
555564
PatKind::Range(_, _, Spanned { node: RangeEnd::Excluded, .. }) => {
556565
gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
557566
"exclusive range pattern syntax is experimental");
@@ -561,7 +570,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
561570
visit::walk_pat(self, pattern)
562571
}
563572

564-
fn visit_fn(&mut self, fn_kind: FnKind<'a>, fn_decl: &'a ast::FnDecl, span: Span, _: NodeId) {
573+
fn visit_fn(&mut self,
574+
fn_kind: FnKind<'a>,
575+
fn_decl: &'a ast::FnDecl,
576+
span: Span,
577+
_node_id: NodeId) {
565578
if let Some(header) = fn_kind.header() {
566579
// Stability of const fn methods are covered in
567580
// `visit_trait_item` and `visit_impl_item` below; this is

src/test/ui/feature-gates/feature-gate-box_patterns.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@ fn main() {
22
let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
33
println!("x: {}", x);
44
}
5-
6-
macro_rules! accept_pat { ($p:pat) => {} }
7-
accept_pat!(box 0); //~ ERROR box pattern syntax is experimental

src/test/ui/feature-gates/feature-gate-box_patterns.stderr

+1-10
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@ LL | let box x = Box::new('c');
77
= note: for more information, see https://github.com/rust-lang/rust/issues/29641
88
= help: add `#![feature(box_patterns)]` to the crate attributes to enable
99

10-
error[E0658]: box pattern syntax is experimental
11-
--> $DIR/feature-gate-box_patterns.rs:7:13
12-
|
13-
LL | accept_pat!(box 0);
14-
| ^^^^^
15-
|
16-
= note: for more information, see https://github.com/rust-lang/rust/issues/29641
17-
= help: add `#![feature(box_patterns)]` to the crate attributes to enable
18-
19-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2011

2112
For more information about this error, try `rustc --explain E0658`.

src/test/ui/or-patterns/or-patterns-syntactic-pass.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// check-pass
55

66
#![feature(or_patterns)]
7-
#![feature(box_patterns)]
87

98
fn main() {}
109

src/test/ui/pattern/rest-pat-syntactic.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
// check-pass
55

6-
#![feature(box_patterns)]
7-
86
fn main() {}
97

108
macro_rules! accept_pat {

0 commit comments

Comments
 (0)