Skip to content

Commit 7ce2514

Browse files
committed
Fix tests
1 parent 6e59c64 commit 7ce2514

8 files changed

+56
-96
lines changed

src/test/ui/parser/lex-bad-char-literals-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: character literal may only contain one codepoint
22
--> $DIR/lex-bad-char-literals-2.rs:3:5
33
|
4-
LL | 'nope' //~ ERROR: character literal may only contain one codepoint: 'nope'
4+
LL | 'nope' //~ ERROR: character literal may only contain one codepoint
55
| ^^^^^^
66

77
error[E0601]: `main` function not found in crate `lex_bad_char_literals_2`
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// This test needs to the last one appearing in this file as it kills the parser
2-
static c: char =
3-
'●●' //~ ERROR: character literal may only contain one codepoint
4-
;
1+
static c: char = '●●';
2+
//~^ ERROR: character literal may only contain one codepoint
3+
54

65
fn main() {
7-
let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
8-
//~^ ERROR: mismatched types
6+
let ch: &str = '●●';
7+
//~^ ERROR: character literal may only contain one codepoint
98
}
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
error: character literal may only contain one codepoint
2-
--> $DIR/lex-bad-char-literals-3.rs:3:5
2+
--> $DIR/lex-bad-char-literals-3.rs:1:18
33
|
4-
LL | '●●' //~ ERROR: character literal may only contain one codepoint
5-
| ^^^^
4+
LL | static c: char = '●●';
5+
| ^^^^
66
help: if you meant to write a `str` literal, use double quotes
77
|
8-
LL | "●●" //~ ERROR: character literal may only contain one codepoint
9-
| ^^^^
8+
LL | static c: char = "●●";
9+
| ^^^^
1010

1111
error: character literal may only contain one codepoint
12-
--> $DIR/lex-bad-char-literals-3.rs:7:20
12+
--> $DIR/lex-bad-char-literals-3.rs:6:20
1313
|
14-
LL | let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
14+
LL | let ch: &str = '●●';
1515
| ^^^^
1616
help: if you meant to write a `str` literal, use double quotes
1717
|
18-
LL | let ch: &str = "●●"; //~ ERROR: character literal may only contain one codepoint
18+
LL | let ch: &str = "●●";
1919
| ^^^^
2020

21-
error[E0308]: mismatched types
22-
--> $DIR/lex-bad-char-literals-3.rs:7:20
23-
|
24-
LL | let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
25-
| ^^^^ expected &str, found char
26-
|
27-
= note: expected type `&str`
28-
found type `char`
29-
30-
error: aborting due to 3 previous errors
21+
error: aborting due to 2 previous errors
3122

32-
For more information about this error, try `rustc --explain E0308`.
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
error: character literal may only contain one codepoint
1+
error: character literal may only contain one codepoint: '●
22
--> $DIR/lex-bad-char-literals-4.rs:4:5
33
|
4-
LL | '● //~ ERROR: character literal may only contain one codepoint: '●
4+
LL | '● //~ ERROR: character literal may only contain one codepoint
55
| ^^
66

7-
error: character literal may only contain one codepoint
8-
--> $DIR/lex-bad-char-literals-4.rs:4:70
9-
|
10-
LL | '● //~ ERROR: character literal may only contain one codepoint: '●
11-
| ^^
12-
13-
error: expected one of `.`, `;`, `?`, or an operator, found `~`
14-
--> $DIR/lex-bad-char-literals-4.rs:4:11
15-
|
16-
LL | '● //~ ERROR: character literal may only contain one codepoint: '●
17-
| ^ expected one of `.`, `;`, `?`, or an operator here
18-
19-
error: aborting due to 3 previous errors
7+
error: aborting due to previous error
208

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
//
2-
// This test needs to the last one appearing in this file as it kills the parser
3-
static c: char =
4-
'\x10\x10' //~ ERROR: character literal may only contain one codepoint
5-
;
1+
static c: char = '\x10\x10';
2+
//~^ ERROR: character literal may only contain one codepoint
63

74
fn main() {
8-
let ch: &str = '\x10\x10'; //~ ERROR: character literal may only contain one codepoint
9-
//~^ ERROR: mismatched types
5+
let ch: &str = '\x10\x10';
6+
//~^ ERROR: character literal may only contain one codepoint
107
}
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
error: character literal may only contain one codepoint
2-
--> $DIR/lex-bad-char-literals-5.rs:4:5
2+
--> $DIR/lex-bad-char-literals-5.rs:1:18
33
|
4-
LL | '/x10/x10' //~ ERROR: character literal may only contain one codepoint
5-
| ^^^^^^^^^^
4+
LL | static c: char = '/x10/x10';
5+
| ^^^^^^^^^^
66
help: if you meant to write a `str` literal, use double quotes
77
|
8-
LL | "/x10/x10" //~ ERROR: character literal may only contain one codepoint
9-
| ^^^^^^^^^^
8+
LL | static c: char = "/x10/x10";
9+
| ^^^^^^^^^^
1010

1111
error: character literal may only contain one codepoint
12-
--> $DIR/lex-bad-char-literals-5.rs:8:20
12+
--> $DIR/lex-bad-char-literals-5.rs:5:20
1313
|
14-
LL | let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
14+
LL | let ch: &str = '/x10/x10';
1515
| ^^^^^^^^^^
1616
help: if you meant to write a `str` literal, use double quotes
1717
|
18-
LL | let ch: &str = "/x10/x10"; //~ ERROR: character literal may only contain one codepoint
18+
LL | let ch: &str = "/x10/x10";
1919
| ^^^^^^^^^^
2020

21-
error[E0308]: mismatched types
22-
--> $DIR/lex-bad-char-literals-5.rs:8:20
23-
|
24-
LL | let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
25-
| ^^^^^^^^^^ expected &str, found char
26-
|
27-
= note: expected type `&str`
28-
found type `char`
29-
30-
error: aborting due to 3 previous errors
21+
error: aborting due to 2 previous errors
3122

32-
For more information about this error, try `rustc --explain E0308`.
+13-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
fn main() {
2-
let x: &str = 'ab'; //~ ERROR: character literal may only contain one codepoint
3-
//~^ ERROR: mismatched types
4-
let y: char = 'cd'; //~ ERROR: character literal may only contain one codepoint
5-
let z = 'ef'; //~ ERROR: character literal may only contain one codepoint
2+
let x: &str = 'ab';
3+
//~^ ERROR: character literal may only contain one codepoint
4+
let y: char = 'cd';
5+
//~^ ERROR: character literal may only contain one codepoint
6+
let z = 'ef';
7+
//~^ ERROR: character literal may only contain one codepoint
68

7-
if x == y {} //~ ERROR: can't compare `&str` with `char`
9+
if x == y {}
10+
//~^ ERROR: can't compare `&str` with `char`
811
if y == z {} // no error here
9-
if x == z {} //~ ERROR: can't compare `&str` with `char`
12+
if x == z {}
13+
//~^ ERROR: can't compare `&str` with `char`
1014

11-
let a: usize = ""; //~ ERROR: mismatched types
12-
}
15+
let a: usize = "";
16+
//~^ ERROR: mismatched types
17+
}
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,47 @@
11
error: character literal may only contain one codepoint
22
--> $DIR/lex-bad-char-literals-6.rs:2:19
33
|
4-
LL | let x: &str = 'ab'; //~ ERROR: character literal may only contain one codepoint
4+
LL | let x: &str = 'ab';
55
| ^^^^
66

77
error: character literal may only contain one codepoint
8-
--> $DIR/lex-bad-char-literals-6.rs:3:19
8+
--> $DIR/lex-bad-char-literals-6.rs:4:19
99
|
10-
LL | let y: char = 'cd'; //~ ERROR: character literal may only contain one codepoint
10+
LL | let y: char = 'cd';
1111
| ^^^^
1212

1313
error: character literal may only contain one codepoint
14-
--> $DIR/lex-bad-char-literals-6.rs:4:13
14+
--> $DIR/lex-bad-char-literals-6.rs:6:13
1515
|
16-
LL | let z = 'ef'; //~ ERROR: character literal may only contain one codepoint
16+
LL | let z = 'ef';
1717
| ^^^^
1818

19-
error[E0308]: mismatched types
20-
--> $DIR/lex-bad-char-literals-6.rs:2:19
21-
|
22-
LL | let x: &str = 'ab'; //~ ERROR: character literal may only contain one codepoint
23-
| ^^^^ expected &str, found char
24-
|
25-
= note: expected type `&str`
26-
found type `char`
27-
2819
error[E0277]: can't compare `&str` with `char`
29-
--> $DIR/lex-bad-char-literals-6.rs:6:10
20+
--> $DIR/lex-bad-char-literals-6.rs:9:10
3021
|
31-
LL | if x == y {} // no error here
22+
LL | if x == y {}
3223
| ^^ no implementation for `&str == char`
3324
|
3425
= help: the trait `std::cmp::PartialEq<char>` is not implemented for `&str`
3526

3627
error[E0308]: mismatched types
37-
--> $DIR/lex-bad-char-literals-6.rs:10:20
28+
--> $DIR/lex-bad-char-literals-6.rs:15:20
3829
|
39-
LL | let a: usize = ""; // type error here to confirm we got past the parser
30+
LL | let a: usize = "";
4031
| ^^ expected usize, found reference
4132
|
4233
= note: expected type `usize`
4334
found type `&'static str`
4435

4536
error[E0277]: can't compare `&str` with `char`
46-
--> $DIR/lex-bad-char-literals-6.rs:8:10
37+
--> $DIR/lex-bad-char-literals-6.rs:12:10
4738
|
48-
LL | if x == z {} // no error here
39+
LL | if x == z {}
4940
| ^^ no implementation for `&str == char`
5041
|
5142
= help: the trait `std::cmp::PartialEq<char>` is not implemented for `&str`
5243

53-
error: aborting due to 7 previous errors
44+
error: aborting due to 6 previous errors
5445

5546
Some errors occurred: E0277, E0308.
5647
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)