summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/recover-range-pats.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/ui/parser/recover-range-pats.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/parser/recover-range-pats.rs')
-rw-r--r--src/test/ui/parser/recover-range-pats.rs159
1 files changed, 0 insertions, 159 deletions
diff --git a/src/test/ui/parser/recover-range-pats.rs b/src/test/ui/parser/recover-range-pats.rs
deleted file mode 100644
index 156c7ad94..000000000
--- a/src/test/ui/parser/recover-range-pats.rs
+++ /dev/null
@@ -1,159 +0,0 @@
-// Here we test all kinds of range patterns in terms of parsing / recovery.
-// We want to ensure that:
-// 1. Things parse as they should.
-// 2. Or at least we have parser recovery if they don't.
-
-#![feature(exclusive_range_pattern)]
-#![deny(ellipsis_inclusive_range_patterns)]
-
-fn main() {}
-
-const X: u8 = 0;
-const Y: u8 = 3;
-
-fn exclusive_from_to() {
- if let 0..3 = 0 {} // OK.
- if let 0..Y = 0 {} // OK.
- if let X..3 = 0 {} // OK.
- if let X..Y = 0 {} // OK.
- if let true..Y = 0 {} //~ ERROR only `char` and numeric types
- if let X..true = 0 {} //~ ERROR only `char` and numeric types
- if let .0..Y = 0 {} //~ ERROR mismatched types
- //~^ ERROR float literals must have an integer part
- if let X.. .0 = 0 {} //~ ERROR mismatched types
- //~^ ERROR float literals must have an integer part
-}
-
-fn inclusive_from_to() {
- if let 0..=3 = 0 {} // OK.
- if let 0..=Y = 0 {} // OK.
- if let X..=3 = 0 {} // OK.
- if let X..=Y = 0 {} // OK.
- if let true..=Y = 0 {} //~ ERROR only `char` and numeric types
- if let X..=true = 0 {} //~ ERROR only `char` and numeric types
- if let .0..=Y = 0 {} //~ ERROR mismatched types
- //~^ ERROR float literals must have an integer part
- if let X..=.0 = 0 {} //~ ERROR mismatched types
- //~^ ERROR float literals must have an integer part
-}
-
-fn inclusive2_from_to() {
- if let 0...3 = 0 {}
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- if let 0...Y = 0 {}
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- if let X...3 = 0 {}
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- if let X...Y = 0 {}
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- if let true...Y = 0 {} //~ ERROR only `char` and numeric types
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- if let X...true = 0 {} //~ ERROR only `char` and numeric types
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- if let .0...Y = 0 {} //~ ERROR mismatched types
- //~^ ERROR float literals must have an integer part
- //~| WARN this is accepted in the current edition
- //~| ERROR `...` range patterns are deprecated
- if let X... .0 = 0 {} //~ ERROR mismatched types
- //~^ ERROR float literals must have an integer part
- //~| ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
-}
-
-fn exclusive_from() {
- if let 0.. = 0 {}
- if let X.. = 0 {}
- if let true.. = 0 {}
- //~^ ERROR only `char` and numeric types
- if let .0.. = 0 {}
- //~^ ERROR float literals must have an integer part
- //~| ERROR mismatched types
-}
-
-fn inclusive_from() {
- if let 0..= = 0 {} //~ ERROR inclusive range with no end
- if let X..= = 0 {} //~ ERROR inclusive range with no end
- if let true..= = 0 {} //~ ERROR inclusive range with no end
- //~| ERROR only `char` and numeric types
- if let .0..= = 0 {} //~ ERROR inclusive range with no end
- //~^ ERROR float literals must have an integer part
- //~| ERROR mismatched types
-}
-
-fn inclusive2_from() {
- if let 0... = 0 {} //~ ERROR inclusive range with no end
- if let X... = 0 {} //~ ERROR inclusive range with no end
- if let true... = 0 {} //~ ERROR inclusive range with no end
- //~| ERROR only `char` and numeric types
- if let .0... = 0 {} //~ ERROR inclusive range with no end
- //~^ ERROR float literals must have an integer part
- //~| ERROR mismatched types
-}
-
-fn exclusive_to() {
- if let ..0 = 0 {}
- if let ..Y = 0 {}
- if let ..true = 0 {}
- //~^ ERROR only `char` and numeric types
- if let .. .0 = 0 {}
- //~^ ERROR float literals must have an integer part
- //~| ERROR mismatched types
-}
-
-fn inclusive_to() {
- if let ..=3 = 0 {}
- if let ..=Y = 0 {}
- if let ..=true = 0 {}
- //~^ ERROR only `char` and numeric types
- if let ..=.0 = 0 {}
- //~^ ERROR float literals must have an integer part
- //~| ERROR mismatched types
-}
-
-fn inclusive2_to() {
- if let ...3 = 0 {}
- //~^ ERROR range-to patterns with `...` are not allowed
- if let ...Y = 0 {}
- //~^ ERROR range-to patterns with `...` are not allowed
- if let ...true = 0 {}
- //~^ ERROR range-to patterns with `...` are not allowed
- //~| ERROR only `char` and numeric types
- if let ....3 = 0 {}
- //~^ ERROR float literals must have an integer part
- //~| ERROR range-to patterns with `...` are not allowed
- //~| ERROR mismatched types
-}
-
-fn with_macro_expr_var() {
- macro_rules! mac2 {
- ($e1:expr, $e2:expr) => {
- let $e1..$e2;
- let $e1...$e2;
- //~^ ERROR `...` range patterns are deprecated
- //~| WARN this is accepted in the current edition
- let $e1..=$e2;
- }
- }
-
- mac2!(0, 1);
-
- macro_rules! mac {
- ($e:expr) => {
- let ..$e;
- let ...$e;
- //~^ ERROR range-to patterns with `...` are not allowed
- let ..=$e;
- let $e..;
- let $e...; //~ ERROR inclusive range with no end
- let $e..=; //~ ERROR inclusive range with no end
- }
- }
-
- mac!(0);
-}