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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+3-3
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

+3-3
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

+3-3
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

+3-3
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

+12-12
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

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@ LL | mac2!(0, 1);
258258
|
259259
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
260260

261-
error[E0029]: only char and numeric types are allowed in range patterns
261+
error[E0029]: only `char` and numeric types are allowed in range patterns
262262
--> $DIR/recover-range-pats.rs:20:12
263263
|
264264
LL | if let true..Y = 0 {}
265265
| ^^^^ - this is of type `u8`
266266
| |
267267
| this is of type `bool` but it should be `char` or numeric
268268

269-
error[E0029]: only char and numeric types are allowed in range patterns
269+
error[E0029]: only `char` and numeric types are allowed in range patterns
270270
--> $DIR/recover-range-pats.rs:21:15
271271
|
272272
LL | if let X..true = 0 {}
@@ -291,15 +291,15 @@ LL | if let X.. .0 = 0 {}
291291
| | expected integer, found floating-point number
292292
| this is of type `u8`
293293

294-
error[E0029]: only char and numeric types are allowed in range patterns
294+
error[E0029]: only `char` and numeric types are allowed in range patterns
295295
--> $DIR/recover-range-pats.rs:33:12
296296
|
297297
LL | if let true..=Y = 0 {}
298298
| ^^^^ - this is of type `u8`
299299
| |
300300
| this is of type `bool` but it should be `char` or numeric
301301

302-
error[E0029]: only char and numeric types are allowed in range patterns
302+
error[E0029]: only `char` and numeric types are allowed in range patterns
303303
--> $DIR/recover-range-pats.rs:34:16
304304
|
305305
LL | if let X..=true = 0 {}
@@ -324,15 +324,15 @@ LL | if let X..=.0 = 0 {}
324324
| | expected integer, found floating-point number
325325
| this is of type `u8`
326326

327-
error[E0029]: only char and numeric types are allowed in range patterns
327+
error[E0029]: only `char` and numeric types are allowed in range patterns
328328
--> $DIR/recover-range-pats.rs:46:12
329329
|
330330
LL | if let true...Y = 0 {}
331331
| ^^^^ - this is of type `u8`
332332
| |
333333
| this is of type `bool` but it should be `char` or numeric
334334

335-
error[E0029]: only char and numeric types are allowed in range patterns
335+
error[E0029]: only `char` and numeric types are allowed in range patterns
336336
--> $DIR/recover-range-pats.rs:48:16
337337
|
338338
LL | if let X...true = 0 {}
@@ -357,7 +357,7 @@ LL | if let X... .0 = 0 {}
357357
| | expected integer, found floating-point number
358358
| this is of type `u8`
359359

360-
error[E0029]: only char and numeric types are allowed in range patterns
360+
error[E0029]: only `char` and numeric types are allowed in range patterns
361361
--> $DIR/recover-range-pats.rs:61:12
362362
|
363363
LL | if let true.. = 0 {}
@@ -369,7 +369,7 @@ error[E0308]: mismatched types
369369
LL | if let .0.. = 0 {}
370370
| ^^ expected integer, found floating-point number
371371

372-
error[E0029]: only char and numeric types are allowed in range patterns
372+
error[E0029]: only `char` and numeric types are allowed in range patterns
373373
--> $DIR/recover-range-pats.rs:71:12
374374
|
375375
LL | if let true..= = 0 {}
@@ -381,7 +381,7 @@ error[E0308]: mismatched types
381381
LL | if let .0..= = 0 {}
382382
| ^^ expected integer, found floating-point number
383383

384-
error[E0029]: only char and numeric types are allowed in range patterns
384+
error[E0029]: only `char` and numeric types are allowed in range patterns
385385
--> $DIR/recover-range-pats.rs:81:12
386386
|
387387
LL | if let true... = 0 {}
@@ -393,7 +393,7 @@ error[E0308]: mismatched types
393393
LL | if let .0... = 0 {}
394394
| ^^ expected integer, found floating-point number
395395

396-
error[E0029]: only char and numeric types are allowed in range patterns
396+
error[E0029]: only `char` and numeric types are allowed in range patterns
397397
--> $DIR/recover-range-pats.rs:91:14
398398
|
399399
LL | if let ..true = 0 {}
@@ -405,7 +405,7 @@ error[E0308]: mismatched types
405405
LL | if let .. .0 = 0 {}
406406
| ^^ expected integer, found floating-point number
407407

408-
error[E0029]: only char and numeric types are allowed in range patterns
408+
error[E0029]: only `char` and numeric types are allowed in range patterns
409409
--> $DIR/recover-range-pats.rs:101:15
410410
|
411411
LL | if let ..=true = 0 {}
@@ -417,7 +417,7 @@ error[E0308]: mismatched types
417417
LL | if let ..=.0 = 0 {}
418418
| ^^ expected integer, found floating-point number
419419

420-
error[E0029]: only char and numeric types are allowed in range patterns
420+
error[E0029]: only `char` and numeric types are allowed in range patterns
421421
--> $DIR/recover-range-pats.rs:113:15
422422
|
423423
LL | if let ...true = 0 {}

src/test/ui/pattern/patkind-litrange-no-expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ enum_number!(Change {
1919
Neg = -1,
2020
Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns
2121
//~| ERROR arbitrary expressions aren't allowed in patterns
22-
//~| ERROR only char and numeric types are allowed in range patterns
22+
//~| ERROR only `char` and numeric types are allowed in range patterns
2323
});
2424

2525
fn main() {}

src/test/ui/pattern/patkind-litrange-no-expr.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error: arbitrary expressions aren't allowed in patterns
1010
LL | Arith = 1 + 1,
1111
| ^^^^^
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/patkind-litrange-no-expr.rs:20:13
1515
|
1616
LL | $( $value ..= 42 => Some($name::$variant), )* // PatKind::Range

src/test/ui/qualified/qualified-path-params.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ impl S {
1818
fn main() {
1919
match 10 {
2020
<S as Tr>::A::f::<u8> => {}
21-
//~^ ERROR expected unit struct, unit variant or constant, found associated function
22-
0 ..= <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
21+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
22+
0 ..= <S as Tr>::A::f::<u8> => {}
23+
//~^ ERROR only `char` and numeric types are allowed in range
2324
}
2425
}

src/test/ui/qualified/qualified-path-params.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0533]: expected unit struct, unit variant or constant, found associated f
44
LL | <S as Tr>::A::f::<u8> => {}
55
| ^^^^^^^^^^^^^^^^^^^^^
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/qualified-path-params.rs:22:15
99
|
1010
LL | 0 ..= <S as Tr>::A::f::<u8> => {}

0 commit comments

Comments
 (0)