diff --git a/src/test/ui/associated-path-shl.rs b/src/test/ui/associated-path-shl.rs
index d159082ab7ad5..20a6fd83faa32 100644
--- a/src/test/ui/associated-path-shl.rs
+++ b/src/test/ui/associated-path-shl.rs
@@ -5,6 +5,5 @@ fn main() {
let _ = <::B>::C; //~ ERROR cannot find type `A` in this scope
let <::B>::C; //~ ERROR cannot find type `A` in this scope
let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope
- //~^ ERROR only char and numeric types are allowed in range patterns
<::B>::C; //~ ERROR cannot find type `A` in this scope
}
diff --git a/src/test/ui/associated-path-shl.stderr b/src/test/ui/associated-path-shl.stderr
index 23918ed2e3912..71ee93f4835fb 100644
--- a/src/test/ui/associated-path-shl.stderr
+++ b/src/test/ui/associated-path-shl.stderr
@@ -23,21 +23,11 @@ LL | let 0 ..= <::B>::C;
| ^ not found in this scope
error[E0412]: cannot find type `A` in this scope
- --> $DIR/associated-path-shl.rs:9:7
+ --> $DIR/associated-path-shl.rs:8:7
|
LL | <::B>::C;
| ^ not found in this scope
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/associated-path-shl.rs:7:15
- |
-LL | let 0 ..= <::B>::C;
- | ^^^^^^^^^^^ ranges require char or numeric types
- |
- = note: start type: {integer}
- = note: end type: [type error]
-
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0029, E0412.
-For more information about an error, try `rustc --explain E0029`.
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs
index a3b7a80642a72..d97b693f52098 100644
--- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs
@@ -4,8 +4,7 @@ fn main() {
match [5..4, 99..105, 43..44] {
[_, 99.., _] => {},
//~^ ERROR `X..` range patterns are not supported
- //~| ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR only char and numeric types are allowed in range patterns
+ //~| ERROR mismatched types
_ => {},
}
}
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr
index 237b26db7c0d9..4ecd8515ee164 100644
--- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr
@@ -4,21 +4,17 @@ error: `X..` range patterns are not supported
LL | [_, 99.., _] => {},
| ^^^^ help: try using the maximum value for the type: `99..MAX`
-error: arbitrary expressions aren't allowed in patterns
+error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13
|
+LL | match [5..4, 99..105, 43..44] {
+ | ----------------------- this match expression has type `std::ops::Range<{integer}>`
LL | [_, 99.., _] => {},
- | ^^^^
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13
- |
-LL | [_, 99.., _] => {},
- | ^^^^ ranges require char or numeric types
+ | ^^^^ expected struct `std::ops::Range`, found integer
|
- = note: start type: {integer}
- = note: end type: [type error]
+ = note: expected type `std::ops::Range<{integer}>`
+ found type `{integer}`
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0029`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs
index 197953a1dc4ba..09f459c9862ee 100644
--- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs
@@ -4,9 +4,8 @@ fn main() {
match [5..4, 99..105, 43..44] {
[_, 99..] => {},
//~^ ERROR `X..` range patterns are not supported
- //~| ERROR arbitrary expressions aren't allowed in patterns
//~| ERROR pattern requires 2 elements but array has 3
- //~| ERROR only char and numeric types are allowed in range patterns
+ //~| ERROR mismatched types
_ => {},
}
}
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr
index b7a64a0ba677c..922d26923158b 100644
--- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr
@@ -4,28 +4,24 @@ error: `X..` range patterns are not supported
LL | [_, 99..] => {},
| ^^^^ help: try using the maximum value for the type: `99..MAX`
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13
- |
-LL | [_, 99..] => {},
- | ^^^^
-
error[E0527]: pattern requires 2 elements but array has 3
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:9
|
LL | [_, 99..] => {},
| ^^^^^^^^^ expected 3 elements
-error[E0029]: only char and numeric types are allowed in range patterns
+error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13
|
+LL | match [5..4, 99..105, 43..44] {
+ | ----------------------- this match expression has type `std::ops::Range<{integer}>`
LL | [_, 99..] => {},
- | ^^^^ ranges require char or numeric types
+ | ^^^^ expected struct `std::ops::Range`, found integer
|
- = note: start type: {integer}
- = note: end type: [type error]
+ = note: expected type `std::ops::Range<{integer}>`
+ found type `{integer}`
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0029, E0527.
-For more information about an error, try `rustc --explain E0029`.
+Some errors have detailed explanations: E0308, E0527.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs
index 782777c10797d..95e58b1d48c88 100644
--- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs
@@ -4,8 +4,7 @@ fn main() {
match [5..4, 99..105, 43..44] {
[..9, 99..100, _] => {},
//~^ ERROR `..X` range patterns are not supported
- //~| ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR only char and numeric types are allowed in range patterns
+ //~| ERROR mismatched types
//~| ERROR mismatched types
_ => {},
}
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr
index 7cc1976def402..8907b875f8e11 100644
--- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr
@@ -4,20 +4,16 @@ error: `..X` range patterns are not supported
LL | [..9, 99..100, _] => {},
| ^^^ help: try using the minimum value for the type: `MIN..9`
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:10
- |
-LL | [..9, 99..100, _] => {},
- | ^^^
-
-error[E0029]: only char and numeric types are allowed in range patterns
+error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:10
|
+LL | match [5..4, 99..105, 43..44] {
+ | ----------------------- this match expression has type `std::ops::Range<{integer}>`
LL | [..9, 99..100, _] => {},
- | ^^^ ranges require char or numeric types
+ | ^^^ expected struct `std::ops::Range`, found integer
|
- = note: start type: [type error]
- = note: end type: {integer}
+ = note: expected type `std::ops::Range<{integer}>`
+ found type `{integer}`
error[E0308]: mismatched types
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:15
@@ -30,7 +26,6 @@ LL | [..9, 99..100, _] => {},
= note: expected type `std::ops::Range<{integer}>`
found type `{integer}`
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0029, E0308.
-For more information about an error, try `rustc --explain E0029`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/pat-tuple-4.rs b/src/test/ui/parser/pat-tuple-4.rs
index 9eedb0f902342..2f03160430a22 100644
--- a/src/test/ui/parser/pat-tuple-4.rs
+++ b/src/test/ui/parser/pat-tuple-4.rs
@@ -1,10 +1,11 @@
fn main() {
+ const PAT: u8 = 0;
+
match 0 {
- (.. pat) => {}
+ (.. PAT) => {}
//~^ ERROR `..X` range patterns are not supported
- //~| ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR cannot find value `pat` in this scope
//~| ERROR exclusive range pattern syntax is experimental
- //~| ERROR only char and numeric types are allowed in range patterns
}
}
+
+const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
diff --git a/src/test/ui/parser/pat-tuple-4.stderr b/src/test/ui/parser/pat-tuple-4.stderr
index d126163476c9b..af3ecce184649 100644
--- a/src/test/ui/parser/pat-tuple-4.stderr
+++ b/src/test/ui/parser/pat-tuple-4.stderr
@@ -1,40 +1,28 @@
error: `..X` range patterns are not supported
- --> $DIR/pat-tuple-4.rs:3:10
+ --> $DIR/pat-tuple-4.rs:5:10
|
-LL | (.. pat) => {}
- | ^^^^^^ help: try using the minimum value for the type: `MIN..pat`
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/pat-tuple-4.rs:3:10
- |
-LL | (.. pat) => {}
- | ^^^^^^
-
-error[E0425]: cannot find value `pat` in this scope
- --> $DIR/pat-tuple-4.rs:3:13
- |
-LL | (.. pat) => {}
- | ^^^ not found in this scope
+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:3:10
+ --> $DIR/pat-tuple-4.rs:5:10
|
-LL | (.. pat) => {}
+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[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/pat-tuple-4.rs:3:10
+error[E0308]: mismatched types
+ --> $DIR/pat-tuple-4.rs:11:30
|
-LL | (.. pat) => {}
- | ^^^^^^ ranges require char or numeric types
+LL | const RECOVERY_WITNESS: () = 0;
+ | ^ expected (), found integer
|
- = note: start type: [type error]
- = note: end type: [type error]
+ = note: expected type `()`
+ found type `{integer}`
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0029, E0425, E0658.
-For more information about an error, try `rustc --explain E0029`.
+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.rs b/src/test/ui/parser/pat-tuple-5.rs
index 5e191ca88e296..5334ef93bb3bd 100644
--- a/src/test/ui/parser/pat-tuple-5.rs
+++ b/src/test/ui/parser/pat-tuple-5.rs
@@ -1,10 +1,10 @@
fn main() {
+ const PAT: u8 = 0;
+
match (0, 1) {
- (pat ..) => {}
+ (PAT ..) => {}
//~^ ERROR `X..` range patterns are not supported
- //~| ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR cannot find value `pat` in this scope
//~| ERROR exclusive range pattern syntax is experimental
- //~| ERROR only char and numeric types are allowed in range patterns
+ //~| ERROR mismatched types
}
}
diff --git a/src/test/ui/parser/pat-tuple-5.stderr b/src/test/ui/parser/pat-tuple-5.stderr
index 06f2a59d90906..09ebdc29a2161 100644
--- a/src/test/ui/parser/pat-tuple-5.stderr
+++ b/src/test/ui/parser/pat-tuple-5.stderr
@@ -1,40 +1,30 @@
error: `X..` range patterns are not supported
- --> $DIR/pat-tuple-5.rs:3:10
+ --> $DIR/pat-tuple-5.rs:5:10
|
-LL | (pat ..) => {}
- | ^^^^^^ help: try using the maximum value for the type: `pat..MAX`
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/pat-tuple-5.rs:3:10
- |
-LL | (pat ..) => {}
- | ^^^^^^
-
-error[E0425]: cannot find value `pat` in this scope
- --> $DIR/pat-tuple-5.rs:3:10
- |
-LL | (pat ..) => {}
- | ^^^ not found in this scope
+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:3:10
+ --> $DIR/pat-tuple-5.rs:5:10
|
-LL | (pat ..) => {}
+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[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/pat-tuple-5.rs:3:10
+error[E0308]: mismatched types
+ --> $DIR/pat-tuple-5.rs:5:10
|
-LL | (pat ..) => {}
- | ^^^^^^ ranges require char or numeric types
+LL | match (0, 1) {
+ | ------ this match expression has type `({integer}, {integer})`
+LL | (PAT ..) => {}
+ | ^^^^^^ expected tuple, found u8
|
- = note: start type: [type error]
- = note: end type: [type error]
+ = note: expected type `({integer}, {integer})`
+ found type `u8`
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0029, E0425, E0658.
-For more information about an error, try `rustc --explain E0029`.
+Some errors have detailed explanations: E0308, E0658.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/recover-range-pats.rs b/src/test/ui/parser/recover-range-pats.rs
index ffec50c4e8314..c66652ff4fa01 100644
--- a/src/test/ui/parser/recover-range-pats.rs
+++ b/src/test/ui/parser/recover-range-pats.rs
@@ -55,105 +55,69 @@ fn inclusive2_from_to() {
}
fn exclusive_from() {
- if let 0.. = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..` range patterns are not supported
- if let X.. = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..` range patterns are not supported
- if let true.. = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..` range patterns are not supported
- if let .0.. = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..` range patterns are not supported
- //~| ERROR float literals must have an integer part
+ if let 0.. = 0 {} //~ ERROR `X..` range patterns are not supported
+ if let X.. = 0 {} //~ ERROR `X..` range patterns are not supported
+ if let true.. = 0 {} //~ ERROR `X..` range patterns are not supported
+ //~^ ERROR only char and numeric types
+ if let .0.. = 0 {} //~ ERROR `X..` range patterns are not supported
+ //~^ ERROR float literals must have an integer part
+ //~| ERROR mismatched types
}
fn inclusive_from() {
- if let 0..= = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..=` range patterns are not supported
- if let X..= = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..=` range patterns are not supported
- if let true..= = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..=` range patterns are not supported
- if let .0..= = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X..=` range patterns are not supported
- //~| ERROR float literals must have an integer part
+ if let 0..= = 0 {} //~ ERROR `X..=` range patterns are not supported
+ if let X..= = 0 {} //~ ERROR `X..=` range patterns are not supported
+ if let true..= = 0 {} //~ ERROR `X..=` range patterns are not supported
+ //~| ERROR only char and numeric types
+ if let .0..= = 0 {} //~ ERROR `X..=` range patterns are not supported
+ //~^ ERROR float literals must have an integer part
+ //~| ERROR mismatched types
}
fn inclusive2_from() {
- if let 0... = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X...` range patterns are not supported
- //~| ERROR `...` range patterns are deprecated
- if let X... = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X...` range patterns are not supported
- //~| ERROR `...` range patterns are deprecated
- if let true... = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X...` range patterns are not supported
- //~| ERROR `...` range patterns are deprecated
- if let .0... = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `X...` range patterns are not supported
- //~| ERROR float literals must have an integer part
+ if let 0... = 0 {} //~ ERROR `X...` range patterns are not supported
+ //~^ ERROR `...` range patterns are deprecated
+ if let X... = 0 {} //~ ERROR `X...` range patterns are not supported
+ //~^ ERROR `...` range patterns are deprecated
+ if let true... = 0 {} //~ ERROR `X...` range patterns are not supported
+ //~^ ERROR `...` range patterns are deprecated
+ //~| ERROR only char and numeric types
+ if let .0... = 0 {} //~ ERROR `X...` range patterns are not supported
+ //~^ ERROR float literals must have an integer part
//~| ERROR `...` range patterns are deprecated
+ //~| ERROR mismatched types
}
fn exclusive_to() {
- if let ..0 = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..X` range patterns are not supported
- if let ..Y = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..X` range patterns are not supported
- if let ..true = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..X` range patterns are not supported
- if let .. .0 = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..X` range patterns are not supported
- //~| ERROR float literals must have an integer part
+ if let ..0 = 0 {} //~ ERROR `..X` range patterns are not supported
+ if let ..Y = 0 {} //~ ERROR `..X` range patterns are not supported
+ if let ..true = 0 {} //~ ERROR `..X` range patterns are not supported
+ //~| ERROR only char and numeric types
+ if let .. .0 = 0 {} //~ ERROR `..X` range patterns are not supported
+ //~^ ERROR float literals must have an integer part
+ //~| ERROR mismatched types
}
fn inclusive_to() {
- if let ..=3 = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..=X` range patterns are not supported
- if let ..=Y = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..=X` range patterns are not supported
- if let ..=true = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..=X` range patterns are not supported
- if let ..=.0 = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `..=X` range patterns are not supported
- //~| ERROR float literals must have an integer part
+ if let ..=3 = 0 {} //~ ERROR `..=X` range patterns are not supported
+ if let ..=Y = 0 {} //~ ERROR `..=X` range patterns are not supported
+ if let ..=true = 0 {} //~ ERROR `..=X` range patterns are not supported
+ //~| ERROR only char and numeric types
+ if let ..=.0 = 0 {} //~ ERROR `..=X` range patterns are not supported
+ //~^ ERROR float literals must have an integer part
+ //~| ERROR mismatched types
}
fn inclusive2_to() {
- if let ...3 = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `...X` range patterns are not supported
- //~| ERROR `...` range patterns are deprecated
- if let ...Y = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `...X` range patterns are not supported
- //~| ERROR `...` range patterns are deprecated
- if let ...true = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `...X` range patterns are not supported
- //~| ERROR `...` range patterns are deprecated
- if let ....3 = 0 {} //~ ERROR only char and numeric types
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- //~| ERROR `...X` range patterns are not supported
- //~| ERROR float literals must have an integer part
+ if let ...3 = 0 {} //~ ERROR `...X` range patterns are not supported
+ //~^ ERROR `...` range patterns are deprecated
+ if let ...Y = 0 {} //~ ERROR `...X` range patterns are not supported
+ //~^ ERROR `...` range patterns are deprecated
+ if let ...true = 0 {} //~ ERROR `...X` range patterns are not supported
+ //~^ ERROR `...` range patterns are deprecated
+ //~| ERROR only char and numeric types
+ if let ....3 = 0 {} //~ ERROR `...X` range patterns are not supported
+ //~^ ERROR float literals must have an integer part
//~| ERROR `...` range patterns are deprecated
+ //~| ERROR mismatched types
}
diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr
index a4d321fae8d30..c50d5e6eb6153 100644
--- a/src/test/ui/parser/recover-range-pats.stderr
+++ b/src/test/ui/parser/recover-range-pats.stderr
@@ -41,322 +41,178 @@ LL | if let 0.. = 0 {}
| ^^^ help: try using the maximum value for the type: `0..MAX`
error: `X..` range patterns are not supported
- --> $DIR/recover-range-pats.rs:61:12
+ --> $DIR/recover-range-pats.rs:59:12
|
LL | if let X.. = 0 {}
| ^^^ help: try using the maximum value for the type: `X..MAX`
error: `X..` range patterns are not supported
- --> $DIR/recover-range-pats.rs:64:12
+ --> $DIR/recover-range-pats.rs:60:12
|
LL | if let true.. = 0 {}
| ^^^^^^ help: try using the maximum value for the type: `true..MAX`
error: float literals must have an integer part
- --> $DIR/recover-range-pats.rs:67:12
+ --> $DIR/recover-range-pats.rs:62:12
|
LL | if let .0.. = 0 {}
| ^^ help: must have an integer part: `0.0`
error: `X..` range patterns are not supported
- --> $DIR/recover-range-pats.rs:67:12
+ --> $DIR/recover-range-pats.rs:62:12
|
LL | if let .0.. = 0 {}
| ^^^^ help: try using the maximum value for the type: `0.0..MAX`
error: `X..=` range patterns are not supported
- --> $DIR/recover-range-pats.rs:74:12
+ --> $DIR/recover-range-pats.rs:68:12
|
LL | if let 0..= = 0 {}
| ^^^^ help: try using the maximum value for the type: `0..=MAX`
error: `X..=` range patterns are not supported
- --> $DIR/recover-range-pats.rs:77:12
+ --> $DIR/recover-range-pats.rs:69:12
|
LL | if let X..= = 0 {}
| ^^^^ help: try using the maximum value for the type: `X..=MAX`
error: `X..=` range patterns are not supported
- --> $DIR/recover-range-pats.rs:80:12
+ --> $DIR/recover-range-pats.rs:70:12
|
LL | if let true..= = 0 {}
| ^^^^^^^ help: try using the maximum value for the type: `true..=MAX`
error: float literals must have an integer part
- --> $DIR/recover-range-pats.rs:83:12
+ --> $DIR/recover-range-pats.rs:72:12
|
LL | if let .0..= = 0 {}
| ^^ help: must have an integer part: `0.0`
error: `X..=` range patterns are not supported
- --> $DIR/recover-range-pats.rs:83:12
+ --> $DIR/recover-range-pats.rs:72:12
|
LL | if let .0..= = 0 {}
| ^^^^^ help: try using the maximum value for the type: `0.0..=MAX`
error: `X...` range patterns are not supported
- --> $DIR/recover-range-pats.rs:90:12
+ --> $DIR/recover-range-pats.rs:78:12
|
LL | if let 0... = 0 {}
| ^^^^ help: try using the maximum value for the type: `0...MAX`
error: `X...` range patterns are not supported
- --> $DIR/recover-range-pats.rs:94:12
+ --> $DIR/recover-range-pats.rs:80:12
|
LL | if let X... = 0 {}
| ^^^^ help: try using the maximum value for the type: `X...MAX`
error: `X...` range patterns are not supported
- --> $DIR/recover-range-pats.rs:98:12
+ --> $DIR/recover-range-pats.rs:82:12
|
LL | if let true... = 0 {}
| ^^^^^^^ help: try using the maximum value for the type: `true...MAX`
error: float literals must have an integer part
- --> $DIR/recover-range-pats.rs:102:12
+ --> $DIR/recover-range-pats.rs:85:12
|
LL | if let .0... = 0 {}
| ^^ help: must have an integer part: `0.0`
error: `X...` range patterns are not supported
- --> $DIR/recover-range-pats.rs:102:12
+ --> $DIR/recover-range-pats.rs:85:12
|
LL | if let .0... = 0 {}
| ^^^^^ help: try using the maximum value for the type: `0.0...MAX`
error: `..X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:110:12
+ --> $DIR/recover-range-pats.rs:92:12
|
LL | if let ..0 = 0 {}
| ^^^ help: try using the minimum value for the type: `MIN..0`
error: `..X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:113:12
+ --> $DIR/recover-range-pats.rs:93:12
|
LL | if let ..Y = 0 {}
| ^^^ help: try using the minimum value for the type: `MIN..Y`
error: `..X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:116:12
+ --> $DIR/recover-range-pats.rs:94:12
|
LL | if let ..true = 0 {}
| ^^^^^^ help: try using the minimum value for the type: `MIN..true`
error: float literals must have an integer part
- --> $DIR/recover-range-pats.rs:119:15
+ --> $DIR/recover-range-pats.rs:96:15
|
LL | if let .. .0 = 0 {}
| ^^ help: must have an integer part: `0.0`
error: `..X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:119:12
+ --> $DIR/recover-range-pats.rs:96:12
|
LL | if let .. .0 = 0 {}
| ^^^^^ help: try using the minimum value for the type: `MIN..0.0`
error: `..=X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:126:12
+ --> $DIR/recover-range-pats.rs:102:12
|
LL | if let ..=3 = 0 {}
| ^^^^ help: try using the minimum value for the type: `MIN..=3`
error: `..=X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:129:12
+ --> $DIR/recover-range-pats.rs:103:12
|
LL | if let ..=Y = 0 {}
| ^^^^ help: try using the minimum value for the type: `MIN..=Y`
error: `..=X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:132:12
+ --> $DIR/recover-range-pats.rs:104:12
|
LL | if let ..=true = 0 {}
| ^^^^^^^ help: try using the minimum value for the type: `MIN..=true`
error: float literals must have an integer part
- --> $DIR/recover-range-pats.rs:135:15
+ --> $DIR/recover-range-pats.rs:106:15
|
LL | if let ..=.0 = 0 {}
| ^^ help: must have an integer part: `0.0`
error: `..=X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:135:12
+ --> $DIR/recover-range-pats.rs:106:12
|
LL | if let ..=.0 = 0 {}
| ^^^^^ help: try using the minimum value for the type: `MIN..=0.0`
error: `...X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:142:12
+ --> $DIR/recover-range-pats.rs:112:12
|
LL | if let ...3 = 0 {}
| ^^^^ help: try using the minimum value for the type: `MIN...3`
error: `...X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:146:12
+ --> $DIR/recover-range-pats.rs:114:12
|
LL | if let ...Y = 0 {}
| ^^^^ help: try using the minimum value for the type: `MIN...Y`
error: `...X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:150:12
+ --> $DIR/recover-range-pats.rs:116:12
|
LL | if let ...true = 0 {}
| ^^^^^^^ help: try using the minimum value for the type: `MIN...true`
error: float literals must have an integer part
- --> $DIR/recover-range-pats.rs:154:15
+ --> $DIR/recover-range-pats.rs:119:15
|
LL | if let ....3 = 0 {}
| ^^ help: must have an integer part: `0.3`
error: `...X` range patterns are not supported
- --> $DIR/recover-range-pats.rs:154:12
- |
-LL | if let ....3 = 0 {}
- | ^^^^^ help: try using the minimum value for the type: `MIN...0.3`
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:58:12
- |
-LL | if let 0.. = 0 {}
- | ^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:61:12
- |
-LL | if let X.. = 0 {}
- | ^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:64:12
- |
-LL | if let true.. = 0 {}
- | ^^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:67:12
- |
-LL | if let .0.. = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:74:12
- |
-LL | if let 0..= = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:77:12
- |
-LL | if let X..= = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:80:12
- |
-LL | if let true..= = 0 {}
- | ^^^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:83:12
- |
-LL | if let .0..= = 0 {}
- | ^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:90:12
- |
-LL | if let 0... = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:94:12
- |
-LL | if let X... = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:98:12
- |
-LL | if let true... = 0 {}
- | ^^^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:102:12
- |
-LL | if let .0... = 0 {}
- | ^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:110:12
- |
-LL | if let ..0 = 0 {}
- | ^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:113:12
- |
-LL | if let ..Y = 0 {}
- | ^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:116:12
- |
-LL | if let ..true = 0 {}
- | ^^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
--> $DIR/recover-range-pats.rs:119:12
|
-LL | if let .. .0 = 0 {}
- | ^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:126:12
- |
-LL | if let ..=3 = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:129:12
- |
-LL | if let ..=Y = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:132:12
- |
-LL | if let ..=true = 0 {}
- | ^^^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:135:12
- |
-LL | if let ..=.0 = 0 {}
- | ^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:142:12
- |
-LL | if let ...3 = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:146:12
- |
-LL | if let ...Y = 0 {}
- | ^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:150:12
- |
-LL | if let ...true = 0 {}
- | ^^^^^^^
-
-error: arbitrary expressions aren't allowed in patterns
- --> $DIR/recover-range-pats.rs:154:12
- |
LL | if let ....3 = 0 {}
- | ^^^^^
+ | ^^^^^ help: try using the minimum value for the type: `MIN...0.3`
error: `...` range patterns are deprecated
--> $DIR/recover-range-pats.rs:41:13
@@ -413,49 +269,49 @@ LL | if let X... .0 = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:90:13
+ --> $DIR/recover-range-pats.rs:78:13
|
LL | if let 0... = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:94:13
+ --> $DIR/recover-range-pats.rs:80:13
|
LL | if let X... = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:98:16
+ --> $DIR/recover-range-pats.rs:82:16
|
LL | if let true... = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:102:14
+ --> $DIR/recover-range-pats.rs:85:14
|
LL | if let .0... = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:142:12
+ --> $DIR/recover-range-pats.rs:112:12
|
LL | if let ...3 = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:146:12
+ --> $DIR/recover-range-pats.rs:114:12
|
LL | if let ...Y = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:150:12
+ --> $DIR/recover-range-pats.rs:116:12
|
LL | if let ...true = 0 {}
| ^^^ help: use `..=` for an inclusive range
error: `...` range patterns are deprecated
- --> $DIR/recover-range-pats.rs:154:12
+ --> $DIR/recover-range-pats.rs:119:12
|
LL | if let ....3 = 0 {}
| ^^^ help: use `..=` for an inclusive range
@@ -569,222 +425,114 @@ LL | if let X... .0 = 0 {}
found type `{float}`
error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:58:12
- |
-LL | if let 0.. = 0 {}
- | ^^^ ranges require char or numeric types
- |
- = note: start type: {integer}
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:61:12
- |
-LL | if let X.. = 0 {}
- | ^^^ ranges require char or numeric types
- |
- = note: start type: u8
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:64:12
+ --> $DIR/recover-range-pats.rs:60:12
|
LL | if let true.. = 0 {}
- | ^^^^^^ ranges require char or numeric types
+ | ^^^^ ranges require char or numeric types
|
= note: start type: bool
= note: end type: [type error]
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:67:12
+error[E0308]: mismatched types
+ --> $DIR/recover-range-pats.rs:62:12
|
LL | if let .0.. = 0 {}
- | ^^^^ ranges require char or numeric types
+ | ^^^^ expected integer, found floating-point number
|
- = note: start type: {float}
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:74:12
- |
-LL | if let 0..= = 0 {}
- | ^^^^ ranges require char or numeric types
- |
- = note: start type: {integer}
- = note: end type: [type error]
+ = note: expected type `{integer}`
+ found type `{float}`
error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:77:12
- |
-LL | if let X..= = 0 {}
- | ^^^^ ranges require char or numeric types
- |
- = note: start type: u8
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:80:12
+ --> $DIR/recover-range-pats.rs:70:12
|
LL | if let true..= = 0 {}
- | ^^^^^^^ ranges require char or numeric types
+ | ^^^^ ranges require char or numeric types
|
= note: start type: bool
= note: end type: [type error]
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:83:12
+error[E0308]: mismatched types
+ --> $DIR/recover-range-pats.rs:72:12
|
LL | if let .0..= = 0 {}
- | ^^^^^ ranges require char or numeric types
- |
- = note: start type: {float}
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:90:12
- |
-LL | if let 0... = 0 {}
- | ^^^^ ranges require char or numeric types
- |
- = note: start type: {integer}
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:94:12
- |
-LL | if let X... = 0 {}
- | ^^^^ ranges require char or numeric types
+ | ^^^^^ expected integer, found floating-point number
|
- = note: start type: u8
- = note: end type: [type error]
+ = note: expected type `{integer}`
+ found type `{float}`
error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:98:12
+ --> $DIR/recover-range-pats.rs:82:12
|
LL | if let true... = 0 {}
- | ^^^^^^^ ranges require char or numeric types
+ | ^^^^ ranges require char or numeric types
|
= note: start type: bool
= note: end type: [type error]
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:102:12
+error[E0308]: mismatched types
+ --> $DIR/recover-range-pats.rs:85:12
|
LL | if let .0... = 0 {}
- | ^^^^^ ranges require char or numeric types
- |
- = note: start type: {float}
- = note: end type: [type error]
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:110:12
- |
-LL | if let ..0 = 0 {}
- | ^^^ ranges require char or numeric types
- |
- = note: start type: [type error]
- = note: end type: {integer}
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:113:12
- |
-LL | if let ..Y = 0 {}
- | ^^^ ranges require char or numeric types
+ | ^^^^^ expected integer, found floating-point number
|
- = note: start type: [type error]
- = note: end type: u8
+ = note: expected type `{integer}`
+ found type `{float}`
error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:116:12
+ --> $DIR/recover-range-pats.rs:94:14
|
LL | if let ..true = 0 {}
- | ^^^^^^ ranges require char or numeric types
+ | ^^^^ ranges require char or numeric types
|
= note: start type: [type error]
= note: end type: bool
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:119:12
+error[E0308]: mismatched types
+ --> $DIR/recover-range-pats.rs:96:12
|
LL | if let .. .0 = 0 {}
- | ^^^^^ ranges require char or numeric types
- |
- = note: start type: [type error]
- = note: end type: {float}
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:126:12
- |
-LL | if let ..=3 = 0 {}
- | ^^^^ ranges require char or numeric types
- |
- = note: start type: [type error]
- = note: end type: {integer}
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:129:12
- |
-LL | if let ..=Y = 0 {}
- | ^^^^ ranges require char or numeric types
+ | ^^^^^ expected integer, found floating-point number
|
- = note: start type: [type error]
- = note: end type: u8
+ = note: expected type `{integer}`
+ found type `{float}`
error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:132:12
+ --> $DIR/recover-range-pats.rs:104:15
|
LL | if let ..=true = 0 {}
- | ^^^^^^^ ranges require char or numeric types
+ | ^^^^ ranges require char or numeric types
|
= note: start type: [type error]
= note: end type: bool
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:135:12
+error[E0308]: mismatched types
+ --> $DIR/recover-range-pats.rs:106:12
|
LL | if let ..=.0 = 0 {}
- | ^^^^^ ranges require char or numeric types
- |
- = note: start type: [type error]
- = note: end type: {float}
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:142:12
- |
-LL | if let ...3 = 0 {}
- | ^^^^ ranges require char or numeric types
- |
- = note: start type: [type error]
- = note: end type: {integer}
-
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:146:12
- |
-LL | if let ...Y = 0 {}
- | ^^^^ ranges require char or numeric types
+ | ^^^^^ expected integer, found floating-point number
|
- = note: start type: [type error]
- = note: end type: u8
+ = note: expected type `{integer}`
+ found type `{float}`
error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:150:12
+ --> $DIR/recover-range-pats.rs:116:15
|
LL | if let ...true = 0 {}
- | ^^^^^^^ ranges require char or numeric types
+ | ^^^^ ranges require char or numeric types
|
= note: start type: [type error]
= note: end type: bool
-error[E0029]: only char and numeric types are allowed in range patterns
- --> $DIR/recover-range-pats.rs:154:12
+error[E0308]: mismatched types
+ --> $DIR/recover-range-pats.rs:119:12
|
LL | if let ....3 = 0 {}
- | ^^^^^ ranges require char or numeric types
+ | ^^^^^ expected integer, found floating-point number
|
- = note: start type: [type error]
- = note: end type: {float}
+ = note: expected type `{integer}`
+ found type `{float}`
-error: aborting due to 112 previous errors
+error: aborting due to 76 previous errors
Some errors have detailed explanations: E0029, E0308.
For more information about an error, try `rustc --explain E0029`.