char
not char
This commit is contained in:
parent
8eb42ba0fb
commit
94c789b275
@ -495,7 +495,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self.tcx.sess,
|
||||
span,
|
||||
E0029,
|
||||
"only char and numeric types are allowed in range patterns"
|
||||
"only `char` and numeric types are allowed in range patterns"
|
||||
);
|
||||
let msg = |ty| format!("this is of type `{}` but it should be `char` or numeric", ty);
|
||||
let mut one_side_err = |first_span, first_ty, second: Option<(bool, Ty<'tcx>, Span)>| {
|
||||
|
@ -5,7 +5,7 @@ fn main() {
|
||||
|
||||
match s {
|
||||
"hello" ..= "world" => {}
|
||||
//~^ ERROR only char and numeric types are allowed in range patterns
|
||||
//~^ ERROR only `char` and numeric types are allowed in range patterns
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/E0029-teach.rs:7:9
|
||||
|
|
||||
LL | "hello" ..= "world" => {}
|
||||
|
@ -3,7 +3,7 @@ fn main() {
|
||||
|
||||
match s {
|
||||
"hello" ..= "world" => {}
|
||||
//~^ ERROR only char and numeric types are allowed in range patterns
|
||||
//~^ ERROR only `char` and numeric types are allowed in range patterns
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/E0029.rs:5:9
|
||||
|
|
||||
LL | "hello" ..= "world" => {}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#![feature(exclusive_range_pattern)]
|
||||
|
||||
fn main() {
|
||||
let "a".. = "a"; //~ ERROR only char and numeric types are allowed in range patterns
|
||||
let .."a" = "a"; //~ ERROR only char and numeric types are allowed in range patterns
|
||||
let ..="a" = "a"; //~ ERROR only char and numeric types are allowed in range patterns
|
||||
let "a".. = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns
|
||||
let .."a" = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns
|
||||
let ..="a" = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/half-open-range-pats-bad-types.rs:5:9
|
||||
|
|
||||
LL | let "a".. = "a";
|
||||
| ^^^ this is of type `&'static str` but it should be `char` or numeric
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/half-open-range-pats-bad-types.rs:6:11
|
||||
|
|
||||
LL | let .."a" = "a";
|
||||
| ^^^ this is of type `&'static str` but it should be `char` or numeric
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/half-open-range-pats-bad-types.rs:7:12
|
||||
|
|
||||
LL | let ..="a" = "a";
|
||||
|
@ -2,17 +2,17 @@ fn main() {
|
||||
match "wow" {
|
||||
"bar" ..= "foo" => { }
|
||||
};
|
||||
//~^^ ERROR only char and numeric types are allowed in range
|
||||
//~^^ ERROR only `char` and numeric types are allowed in range
|
||||
|
||||
match "wow" {
|
||||
10 ..= "what" => ()
|
||||
};
|
||||
//~^^ ERROR only char and numeric types are allowed in range
|
||||
//~^^ ERROR only `char` and numeric types are allowed in range
|
||||
|
||||
match "wow" {
|
||||
true ..= "what" => {}
|
||||
};
|
||||
//~^^ ERROR only char and numeric types are allowed in range
|
||||
//~^^ ERROR only `char` and numeric types are allowed in range
|
||||
|
||||
match 5 {
|
||||
'c' ..= 100 => { }
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/match-range-fail.rs:3:9
|
||||
|
|
||||
LL | "bar" ..= "foo" => { }
|
||||
@ -7,7 +7,7 @@ LL | "bar" ..= "foo" => { }
|
||||
| | this is of type `&'static str` but it should be `char` or numeric
|
||||
| this is of type `&'static str` but it should be `char` or numeric
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/match-range-fail.rs:8:16
|
||||
|
|
||||
LL | 10 ..= "what" => ()
|
||||
@ -15,7 +15,7 @@ LL | 10 ..= "what" => ()
|
||||
| |
|
||||
| this is of type `{integer}`
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/match-range-fail.rs:13:9
|
||||
|
|
||||
LL | true ..= "what" => {}
|
||||
|
@ -17,8 +17,8 @@ fn exclusive_from_to() {
|
||||
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 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
|
||||
@ -30,8 +30,8 @@ fn inclusive_from_to() {
|
||||
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 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
|
||||
@ -43,9 +43,9 @@ fn inclusive2_from_to() {
|
||||
if let 0...Y = 0 {} //~ ERROR `...` range patterns are deprecated
|
||||
if let X...3 = 0 {} //~ ERROR `...` range patterns are deprecated
|
||||
if let X...Y = 0 {} //~ ERROR `...` range patterns are deprecated
|
||||
if let true...Y = 0 {} //~ ERROR only char and numeric types
|
||||
if let true...Y = 0 {} //~ ERROR only `char` and numeric types
|
||||
//~^ ERROR `...` range patterns are deprecated
|
||||
if let X...true = 0 {} //~ ERROR only char and numeric types
|
||||
if let X...true = 0 {} //~ ERROR only `char` and numeric types
|
||||
//~^ ERROR `...` range patterns are deprecated
|
||||
if let .0...Y = 0 {} //~ ERROR mismatched types
|
||||
//~^ ERROR float literals must have an integer part
|
||||
@ -59,7 +59,7 @@ fn exclusive_from() {
|
||||
if let 0.. = 0 {}
|
||||
if let X.. = 0 {}
|
||||
if let true.. = 0 {}
|
||||
//~^ ERROR only char and numeric types
|
||||
//~^ ERROR only `char` and numeric types
|
||||
if let .0.. = 0 {}
|
||||
//~^ ERROR float literals must have an integer part
|
||||
//~| ERROR mismatched types
|
||||
@ -69,7 +69,7 @@ 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
|
||||
//~| 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
|
||||
@ -79,7 +79,7 @@ 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
|
||||
//~| 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
|
||||
@ -89,7 +89,7 @@ fn exclusive_to() {
|
||||
if let ..0 = 0 {}
|
||||
if let ..Y = 0 {}
|
||||
if let ..true = 0 {}
|
||||
//~^ ERROR only char and numeric types
|
||||
//~^ ERROR only `char` and numeric types
|
||||
if let .. .0 = 0 {}
|
||||
//~^ ERROR float literals must have an integer part
|
||||
//~| ERROR mismatched types
|
||||
@ -99,7 +99,7 @@ fn inclusive_to() {
|
||||
if let ..=3 = 0 {}
|
||||
if let ..=Y = 0 {}
|
||||
if let ..=true = 0 {}
|
||||
//~^ ERROR only char and numeric types
|
||||
//~^ ERROR only `char` and numeric types
|
||||
if let ..=.0 = 0 {}
|
||||
//~^ ERROR float literals must have an integer part
|
||||
//~| ERROR mismatched types
|
||||
@ -112,7 +112,7 @@ fn inclusive2_to() {
|
||||
//~^ 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
|
||||
//~| 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
|
||||
|
@ -258,7 +258,7 @@ LL | mac2!(0, 1);
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:20:12
|
||||
|
|
||||
LL | if let true..Y = 0 {}
|
||||
@ -266,7 +266,7 @@ LL | if let true..Y = 0 {}
|
||||
| |
|
||||
| this is of type `bool` but it should be `char` or numeric
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:21:15
|
||||
|
|
||||
LL | if let X..true = 0 {}
|
||||
@ -291,7 +291,7 @@ LL | if let X.. .0 = 0 {}
|
||||
| | expected integer, found floating-point number
|
||||
| this is of type `u8`
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:33:12
|
||||
|
|
||||
LL | if let true..=Y = 0 {}
|
||||
@ -299,7 +299,7 @@ LL | if let true..=Y = 0 {}
|
||||
| |
|
||||
| this is of type `bool` but it should be `char` or numeric
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:34:16
|
||||
|
|
||||
LL | if let X..=true = 0 {}
|
||||
@ -324,7 +324,7 @@ LL | if let X..=.0 = 0 {}
|
||||
| | expected integer, found floating-point number
|
||||
| this is of type `u8`
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:46:12
|
||||
|
|
||||
LL | if let true...Y = 0 {}
|
||||
@ -332,7 +332,7 @@ LL | if let true...Y = 0 {}
|
||||
| |
|
||||
| this is of type `bool` but it should be `char` or numeric
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:48:16
|
||||
|
|
||||
LL | if let X...true = 0 {}
|
||||
@ -357,7 +357,7 @@ LL | if let X... .0 = 0 {}
|
||||
| | expected integer, found floating-point number
|
||||
| this is of type `u8`
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:61:12
|
||||
|
|
||||
LL | if let true.. = 0 {}
|
||||
@ -369,7 +369,7 @@ error[E0308]: mismatched types
|
||||
LL | if let .0.. = 0 {}
|
||||
| ^^ expected integer, found floating-point number
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:71:12
|
||||
|
|
||||
LL | if let true..= = 0 {}
|
||||
@ -381,7 +381,7 @@ error[E0308]: mismatched types
|
||||
LL | if let .0..= = 0 {}
|
||||
| ^^ expected integer, found floating-point number
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:81:12
|
||||
|
|
||||
LL | if let true... = 0 {}
|
||||
@ -393,7 +393,7 @@ error[E0308]: mismatched types
|
||||
LL | if let .0... = 0 {}
|
||||
| ^^ expected integer, found floating-point number
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:91:14
|
||||
|
|
||||
LL | if let ..true = 0 {}
|
||||
@ -405,7 +405,7 @@ error[E0308]: mismatched types
|
||||
LL | if let .. .0 = 0 {}
|
||||
| ^^ expected integer, found floating-point number
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:101:15
|
||||
|
|
||||
LL | if let ..=true = 0 {}
|
||||
@ -417,7 +417,7 @@ error[E0308]: mismatched types
|
||||
LL | if let ..=.0 = 0 {}
|
||||
| ^^ expected integer, found floating-point number
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/recover-range-pats.rs:113:15
|
||||
|
|
||||
LL | if let ...true = 0 {}
|
||||
|
@ -19,7 +19,7 @@ enum_number!(Change {
|
||||
Neg = -1,
|
||||
Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns
|
||||
//~| ERROR arbitrary expressions aren't allowed in patterns
|
||||
//~| ERROR only char and numeric types are allowed in range patterns
|
||||
//~| ERROR only `char` and numeric types are allowed in range patterns
|
||||
});
|
||||
|
||||
fn main() {}
|
||||
|
@ -10,7 +10,7 @@ error: arbitrary expressions aren't allowed in patterns
|
||||
LL | Arith = 1 + 1,
|
||||
| ^^^^^
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/patkind-litrange-no-expr.rs:20:13
|
||||
|
|
||||
LL | $( $value ..= 42 => Some($name::$variant), )* // PatKind::Range
|
||||
|
@ -18,7 +18,8 @@ impl S {
|
||||
fn main() {
|
||||
match 10 {
|
||||
<S as Tr>::A::f::<u8> => {}
|
||||
//~^ ERROR expected unit struct, unit variant or constant, found associated function
|
||||
0 ..= <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
|
||||
//~^ ERROR expected unit struct, unit variant or constant, found associated function
|
||||
0 ..= <S as Tr>::A::f::<u8> => {}
|
||||
//~^ ERROR only `char` and numeric types are allowed in range
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0533]: expected unit struct, unit variant or constant, found associated f
|
||||
LL | <S as Tr>::A::f::<u8> => {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0029]: only char and numeric types are allowed in range patterns
|
||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||
--> $DIR/qualified-path-params.rs:22:15
|
||||
|
|
||||
LL | 0 ..= <S as Tr>::A::f::<u8> => {}
|
||||
|
Loading…
Reference in New Issue
Block a user