Skip to content

Commit c9c5068

Browse files
committed
char not char
1 parent 4382436 commit c9c5068

15 files changed

+47
-46
lines changed

compiler/rustc_typeck/src/check/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
494494
self.tcx.sess,
495495
span,
496496
E0029,
497-
"only char and numeric types are allowed in range patterns"
497+
"only `char` and numeric types are allowed in range patterns"
498498
);
499499
let msg = |ty| format!("this is of type `{}` but it should be `char` or numeric", ty);
500500
let mut one_side_err = |first_span, first_ty, second: Option<(bool, Ty<'tcx>, Span)>| {

src/test/ui/error-codes/E0029-teach.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fn main() {
55

66
match s {
77
"hello" ..= "world" => {}
8-
//~^ ERROR only char and numeric types are allowed in range patterns
8+
//~^ ERROR only `char` and numeric types are allowed in range patterns
99
_ => {}
1010
}
1111
}

src/test/ui/error-codes/E0029-teach.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0029]: only char and numeric types are allowed in range patterns
1+
error[E0029]: only `char` and numeric types are allowed in range patterns
22
--> $DIR/E0029-teach.rs:7:9
33
|
44
LL | "hello" ..= "world" => {}

src/test/ui/error-codes/E0029.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fn main() {
33

44
match s {
55
"hello" ..= "world" => {}
6-
//~^ ERROR only char and numeric types are allowed in range patterns
6+
//~^ ERROR only `char` and numeric types are allowed in range patterns
77
_ => {}
88
}
99
}

src/test/ui/error-codes/E0029.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0029]: only char and numeric types are allowed in range patterns
1+
error[E0029]: only `char` and numeric types are allowed in range patterns
22
--> $DIR/E0029.rs:5:9
33
|
44
LL | "hello" ..= "world" => {}

src/test/ui/half-open-range-patterns/half-open-range-pats-bad-types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![feature(exclusive_range_pattern)]
33

44
fn main() {
5-
let "a".. = "a"; //~ ERROR only char and numeric types are allowed in range patterns
6-
let .."a" = "a"; //~ ERROR only char and numeric types are allowed in range patterns
7-
let ..="a" = "a"; //~ ERROR only char and numeric types are allowed in range patterns
5+
let "a".. = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns
6+
let .."a" = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns
7+
let ..="a" = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns
88
}

src/test/ui/half-open-range-patterns/half-open-range-pats-bad-types.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error[E0029]: only char and numeric types are allowed in range patterns
1+
error[E0029]: only `char` and numeric types are allowed in range patterns
22
--> $DIR/half-open-range-pats-bad-types.rs:5:9
33
|
44
LL | let "a".. = "a";
55
| ^^^ this is of type `&'static str` but it should be `char` or numeric
66

7-
error[E0029]: only char and numeric types are allowed in range patterns
7+
error[E0029]: only `char` and numeric types are allowed in range patterns
88
--> $DIR/half-open-range-pats-bad-types.rs:6:11
99
|
1010
LL | let .."a" = "a";
1111
| ^^^ this is of type `&'static str` but it should be `char` or numeric
1212

13-
error[E0029]: only char and numeric types are allowed in range patterns
13+
error[E0029]: only `char` and numeric types are allowed in range patterns
1414
--> $DIR/half-open-range-pats-bad-types.rs:7:12
1515
|
1616
LL | let ..="a" = "a";

src/test/ui/match/match-range-fail.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ fn main() {
22
match "wow" {
33
"bar" ..= "foo" => { }
44
};
5-
//~^^ ERROR only char and numeric types are allowed in range
5+
//~^^ ERROR only `char` and numeric types are allowed in range
66

77
match "wow" {
88
10 ..= "what" => ()
99
};
10-
//~^^ ERROR only char and numeric types are allowed in range
10+
//~^^ ERROR only `char` and numeric types are allowed in range
1111

1212
match "wow" {
1313
true ..= "what" => {}
1414
};
15-
//~^^ ERROR only char and numeric types are allowed in range
15+
//~^^ ERROR only `char` and numeric types are allowed in range
1616

1717
match 5 {
1818
'c' ..= 100 => { }

src/test/ui/match/match-range-fail.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0029]: only char and numeric types are allowed in range patterns
1+
error[E0029]: only `char` and numeric types are allowed in range patterns
22
--> $DIR/match-range-fail.rs:3:9
33
|
44
LL | "bar" ..= "foo" => { }
@@ -7,15 +7,15 @@ LL | "bar" ..= "foo" => { }
77
| | this is of type `&'static str` but it should be `char` or numeric
88
| this is of type `&'static str` but it should be `char` or numeric
99

10-
error[E0029]: only char and numeric types are allowed in range patterns
10+
error[E0029]: only `char` and numeric types are allowed in range patterns
1111
--> $DIR/match-range-fail.rs:8:16
1212
|
1313
LL | 10 ..= "what" => ()
1414
| -- ^^^^^^ this is of type `&'static str` but it should be `char` or numeric
1515
| |
1616
| this is of type `{integer}`
1717

18-
error[E0029]: only char and numeric types are allowed in range patterns
18+
error[E0029]: only `char` and numeric types are allowed in range patterns
1919
--> $DIR/match-range-fail.rs:13:9
2020
|
2121
LL | true ..= "what" => {}

src/test/ui/parser/recover-range-pats.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ fn exclusive_from_to() {
1717
if let 0..Y = 0 {} // OK.
1818
if let X..3 = 0 {} // OK.
1919
if let X..Y = 0 {} // OK.
20-
if let true..Y = 0 {} //~ ERROR only char and numeric types
21-
if let X..true = 0 {} //~ ERROR only char and numeric types
20+
if let true..Y = 0 {} //~ ERROR only `char` and numeric types
21+
if let X..true = 0 {} //~ ERROR only `char` and numeric types
2222
if let .0..Y = 0 {} //~ ERROR mismatched types
2323
//~^ ERROR float literals must have an integer part
2424
if let X.. .0 = 0 {} //~ ERROR mismatched types
@@ -30,8 +30,8 @@ fn inclusive_from_to() {
3030
if let 0..=Y = 0 {} // OK.
3131
if let X..=3 = 0 {} // OK.
3232
if let X..=Y = 0 {} // OK.
33-
if let true..=Y = 0 {} //~ ERROR only char and numeric types
34-
if let X..=true = 0 {} //~ ERROR only char and numeric types
33+
if let true..=Y = 0 {} //~ ERROR only `char` and numeric types
34+
if let X..=true = 0 {} //~ ERROR only `char` and numeric types
3535
if let .0..=Y = 0 {} //~ ERROR mismatched types
3636
//~^ ERROR float literals must have an integer part
3737
if let X..=.0 = 0 {} //~ ERROR mismatched types
@@ -43,9 +43,9 @@ fn inclusive2_from_to() {
4343
if let 0...Y = 0 {} //~ ERROR `...` range patterns are deprecated
4444
if let X...3 = 0 {} //~ ERROR `...` range patterns are deprecated
4545
if let X...Y = 0 {} //~ ERROR `...` range patterns are deprecated
46-
if let true...Y = 0 {} //~ ERROR only char and numeric types
46+
if let true...Y = 0 {} //~ ERROR only `char` and numeric types
4747
//~^ ERROR `...` range patterns are deprecated
48-
if let X...true = 0 {} //~ ERROR only char and numeric types
48+
if let X...true = 0 {} //~ ERROR only `char` and numeric types
4949
//~^ ERROR `...` range patterns are deprecated
5050
if let .0...Y = 0 {} //~ ERROR mismatched types
5151
//~^ ERROR float literals must have an integer part
@@ -59,7 +59,7 @@ fn exclusive_from() {
5959
if let 0.. = 0 {}
6060
if let X.. = 0 {}
6161
if let true.. = 0 {}
62-
//~^ ERROR only char and numeric types
62+
//~^ ERROR only `char` and numeric types
6363
if let .0.. = 0 {}
6464
//~^ ERROR float literals must have an integer part
6565
//~| ERROR mismatched types
@@ -69,7 +69,7 @@ fn inclusive_from() {
6969
if let 0..= = 0 {} //~ ERROR inclusive range with no end
7070
if let X..= = 0 {} //~ ERROR inclusive range with no end
7171
if let true..= = 0 {} //~ ERROR inclusive range with no end
72-
//~| ERROR only char and numeric types
72+
//~| ERROR only `char` and numeric types
7373
if let .0..= = 0 {} //~ ERROR inclusive range with no end
7474
//~^ ERROR float literals must have an integer part
7575
//~| ERROR mismatched types
@@ -79,7 +79,7 @@ fn inclusive2_from() {
7979
if let 0... = 0 {} //~ ERROR inclusive range with no end
8080
if let X... = 0 {} //~ ERROR inclusive range with no end
8181
if let true... = 0 {} //~ ERROR inclusive range with no end
82-
//~| ERROR only char and numeric types
82+
//~| ERROR only `char` and numeric types
8383
if let .0... = 0 {} //~ ERROR inclusive range with no end
8484
//~^ ERROR float literals must have an integer part
8585
//~| ERROR mismatched types
@@ -89,7 +89,7 @@ fn exclusive_to() {
8989
if let ..0 = 0 {}
9090
if let ..Y = 0 {}
9191
if let ..true = 0 {}
92-
//~^ ERROR only char and numeric types
92+
//~^ ERROR only `char` and numeric types
9393
if let .. .0 = 0 {}
9494
//~^ ERROR float literals must have an integer part
9595
//~| ERROR mismatched types
@@ -99,7 +99,7 @@ fn inclusive_to() {
9999
if let ..=3 = 0 {}
100100
if let ..=Y = 0 {}
101101
if let ..=true = 0 {}
102-
//~^ ERROR only char and numeric types
102+
//~^ ERROR only `char` and numeric types
103103
if let ..=.0 = 0 {}
104104
//~^ ERROR float literals must have an integer part
105105
//~| ERROR mismatched types
@@ -112,7 +112,7 @@ fn inclusive2_to() {
112112
//~^ ERROR range-to patterns with `...` are not allowed
113113
if let ...true = 0 {}
114114
//~^ ERROR range-to patterns with `...` are not allowed
115-
//~| ERROR only char and numeric types
115+
//~| ERROR only `char` and numeric types
116116
if let ....3 = 0 {}
117117
//~^ ERROR float literals must have an integer part
118118
//~| ERROR range-to patterns with `...` are not allowed

0 commit comments

Comments
 (0)