diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-31 18:30:25 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-31 19:08:11 +0200 |
| commit | 4c48355c69148c49d1becc26dcc6439650a35589 (patch) | |
| tree | 24d6a09283b97e490807b4262900f3c1ab15bf32 | |
| parent | 8645ac4218e2c503c616ebcfccf034c07a94f405 (diff) | |
| download | rust-4c48355c69148c49d1becc26dcc6439650a35589.tar.gz rust-4c48355c69148c49d1becc26dcc6439650a35589.zip | |
Revert "pre-expansion gate exclusive_range_pattern"
This reverts commit 665a876e307933c6480a6c55a3e38e88937aff2c.
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/parser/pat-tuple-4.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/parser/pat-tuple-4.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/parser/pat-tuple-5.stderr | 4 |
6 files changed, 26 insertions, 23 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 52fb4761527..7c5b75387d2 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -3,8 +3,9 @@ use super::accepted::ACCEPTED_FEATURES; use super::removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES}; use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; -use crate::ast::{self, NodeId, PatKind, VariantData}; +use crate::ast::{self, NodeId, PatKind, RangeEnd, VariantData}; use crate::attr::{self, check_builtin_attribute}; +use crate::source_map::Spanned; use crate::edition::{ALL_EDITIONS, Edition}; use crate::visit::{self, FnKind, Visitor}; use crate::parse::token; @@ -551,6 +552,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } } + PatKind::Range(_, _, Spanned { node: RangeEnd::Excluded, .. }) => { + gate_feature_post!(&self, exclusive_range_pattern, pattern.span, + "exclusive range pattern syntax is experimental"); + } _ => {} } visit::walk_pat(self, pattern) diff --git a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs index 594ec73fe26..ded08b93fe8 100644 --- a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs +++ b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs @@ -1,10 +1,6 @@ -#[cfg(FALSE)] -fn foo() { +pub fn main() { match 22 { 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental - PATH .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental _ => {} } } - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr index 075fdbed90d..ee20408d178 100644 --- a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr +++ b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr @@ -1,21 +1,12 @@ error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/feature-gate-exclusive-range-pattern.rs:4:11 + --> $DIR/feature-gate-exclusive-range-pattern.rs:3:9 | LL | 0 .. 3 => {} - | ^^ + | ^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/37854 = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/feature-gate-exclusive-range-pattern.rs:5:14 - | -LL | PATH .. 3 => {} - | ^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/37854 - = help: add `#![feature(exclusive_range_pattern)]` 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/parser/pat-tuple-4.rs b/src/test/ui/parser/pat-tuple-4.rs index 6b8c146949a..2f03160430a 100644 --- a/src/test/ui/parser/pat-tuple-4.rs +++ b/src/test/ui/parser/pat-tuple-4.rs @@ -4,6 +4,7 @@ fn main() { match 0 { (.. PAT) => {} //~^ ERROR `..X` range patterns are not supported + //~| ERROR exclusive range pattern syntax is experimental } } diff --git a/src/test/ui/parser/pat-tuple-4.stderr b/src/test/ui/parser/pat-tuple-4.stderr index 1962dc4ff20..af3ecce1846 100644 --- a/src/test/ui/parser/pat-tuple-4.stderr +++ b/src/test/ui/parser/pat-tuple-4.stderr @@ -4,8 +4,17 @@ error: `..X` range patterns are not supported LL | (.. PAT) => {} | ^^^^^^ help: try using the minimum value for the type: `MIN..PAT` +error[E0658]: exclusive range pattern syntax is experimental + --> $DIR/pat-tuple-4.rs:5:10 + | +LL | (.. PAT) => {} + | ^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/37854 + = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable + error[E0308]: mismatched types - --> $DIR/pat-tuple-4.rs:10:30 + --> $DIR/pat-tuple-4.rs:11:30 | LL | const RECOVERY_WITNESS: () = 0; | ^ expected (), found integer @@ -13,6 +22,7 @@ LL | const RECOVERY_WITNESS: () = 0; = note: expected type `()` found type `{integer}` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0308, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/pat-tuple-5.stderr b/src/test/ui/parser/pat-tuple-5.stderr index 17155b4dd49..09ebdc29a21 100644 --- a/src/test/ui/parser/pat-tuple-5.stderr +++ b/src/test/ui/parser/pat-tuple-5.stderr @@ -5,10 +5,10 @@ LL | (PAT ..) => {} | ^^^^^^ help: try using the maximum value for the type: `PAT..MAX` error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/pat-tuple-5.rs:5:14 + --> $DIR/pat-tuple-5.rs:5:10 | LL | (PAT ..) => {} - | ^^ + | ^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/37854 = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable |
