Skip to content

Commit 4c48355

Browse files
committed
Revert "pre-expansion gate exclusive_range_pattern"
This reverts commit 665a876.
1 parent 8645ac4 commit 4c48355

File tree

6 files changed

+26
-23
lines changed

6 files changed

+26
-23
lines changed

src/libsyntax/feature_gate/check.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use super::accepted::ACCEPTED_FEATURES;
33
use super::removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
44
use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
55

6-
use crate::ast::{self, NodeId, PatKind, VariantData};
6+
use crate::ast::{self, NodeId, PatKind, RangeEnd, VariantData};
77
use crate::attr::{self, check_builtin_attribute};
8+
use crate::source_map::Spanned;
89
use crate::edition::{ALL_EDITIONS, Edition};
910
use crate::visit::{self, FnKind, Visitor};
1011
use crate::parse::token;
@@ -551,6 +552,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
551552
}
552553
}
553554
}
555+
PatKind::Range(_, _, Spanned { node: RangeEnd::Excluded, .. }) => {
556+
gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
557+
"exclusive range pattern syntax is experimental");
558+
}
554559
_ => {}
555560
}
556561
visit::walk_pat(self, pattern)
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
#[cfg(FALSE)]
2-
fn foo() {
1+
pub fn main() {
32
match 22 {
43
0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental
5-
PATH .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental
64
_ => {}
75
}
86
}
9-
10-
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
error[E0658]: exclusive range pattern syntax is experimental
2-
--> $DIR/feature-gate-exclusive-range-pattern.rs:4:11
2+
--> $DIR/feature-gate-exclusive-range-pattern.rs:3:9
33
|
44
LL | 0 .. 3 => {}
5-
| ^^
5+
| ^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
88
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
99

10-
error[E0658]: exclusive range pattern syntax is experimental
11-
--> $DIR/feature-gate-exclusive-range-pattern.rs:5:14
12-
|
13-
LL | PATH .. 3 => {}
14-
| ^^
15-
|
16-
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
17-
= help: add `#![feature(exclusive_range_pattern)]` 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/parser/pat-tuple-4.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fn main() {
44
match 0 {
55
(.. PAT) => {}
66
//~^ ERROR `..X` range patterns are not supported
7+
//~| ERROR exclusive range pattern syntax is experimental
78
}
89
}
910

src/test/ui/parser/pat-tuple-4.stderr

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ error: `..X` range patterns are not supported
44
LL | (.. PAT) => {}
55
| ^^^^^^ help: try using the minimum value for the type: `MIN..PAT`
66

7+
error[E0658]: exclusive range pattern syntax is experimental
8+
--> $DIR/pat-tuple-4.rs:5:10
9+
|
10+
LL | (.. PAT) => {}
11+
| ^^^^^^
12+
|
13+
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
14+
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
15+
716
error[E0308]: mismatched types
8-
--> $DIR/pat-tuple-4.rs:10:30
17+
--> $DIR/pat-tuple-4.rs:11:30
918
|
1019
LL | const RECOVERY_WITNESS: () = 0;
1120
| ^ expected (), found integer
1221
|
1322
= note: expected type `()`
1423
found type `{integer}`
1524

16-
error: aborting due to 2 previous errors
25+
error: aborting due to 3 previous errors
1726

18-
For more information about this error, try `rustc --explain E0308`.
27+
Some errors have detailed explanations: E0308, E0658.
28+
For more information about an error, try `rustc --explain E0308`.

src/test/ui/parser/pat-tuple-5.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | (PAT ..) => {}
55
| ^^^^^^ help: try using the maximum value for the type: `PAT..MAX`
66

77
error[E0658]: exclusive range pattern syntax is experimental
8-
--> $DIR/pat-tuple-5.rs:5:14
8+
--> $DIR/pat-tuple-5.rs:5:10
99
|
1010
LL | (PAT ..) => {}
11-
| ^^
11+
| ^^^^^^
1212
|
1313
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
1414
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable

0 commit comments

Comments
 (0)