Skip to content

Commit b721c1a

Browse files
committed
Fix tests
1 parent 8bbb63c commit b721c1a

File tree

7 files changed

+67
-11
lines changed

7 files changed

+67
-11
lines changed

src/test/ui/parser/lex-bad-char-literals-3.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ static c: char =
33
'●●' //~ ERROR: character literal may only contain one codepoint
44
;
55

6-
fn main() {}
6+
fn main() {
7+
let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
8+
//~^ ERROR: mismatched types
9+
}

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,25 @@ help: if you meant to write a `str` literal, use double quotes
88
LL | "●●" //~ ERROR: character literal may only contain one codepoint
99
| ^^^^
1010

11-
error: aborting due to previous error
11+
error: character literal may only contain one codepoint
12+
--> $DIR/lex-bad-char-literals-3.rs:7:20
13+
|
14+
LL | let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
15+
| ^^^^
16+
help: if you meant to write a `str` literal, use double quotes
17+
|
18+
LL | let ch: &str = "●●"; //~ ERROR: character literal may only contain one codepoint
19+
| ^^^^
20+
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
1231

32+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/parser/lex-bad-char-literals-5.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ static c: char =
44
'\x10\x10' //~ ERROR: character literal may only contain one codepoint
55
;
66

7-
fn main() {}
7+
fn main() {
8+
let ch: &str = '\x10\x10'; //~ ERROR: character literal may only contain one codepoint
9+
//~^ ERROR: mismatched types
10+
}

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,25 @@ help: if you meant to write a `str` literal, use double quotes
88
LL | "/x10/x10" //~ ERROR: character literal may only contain one codepoint
99
| ^^^^^^^^^^
1010

11-
error: aborting due to previous error
11+
error: character literal may only contain one codepoint
12+
--> $DIR/lex-bad-char-literals-5.rs:8:20
13+
|
14+
LL | let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
15+
| ^^^^^^^^^^
16+
help: if you meant to write a `str` literal, use double quotes
17+
|
18+
LL | let ch: &str = "/x10/x10"; //~ ERROR: character literal may only contain one codepoint
19+
| ^^^^^^^^^^
20+
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
1231

32+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/str/str-as-char.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

33
fn main() {
4-
println!("●●");
5-
//~^ ERROR character literal may only contain one codepoint
4+
println!("{}", "●●"); //~ ERROR character literal may only contain one codepoint
5+
//~^ ERROR format argument must be a string literal
66
}

src/test/ui/str/str-as-char.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

33
fn main() {
4-
println!('●●');
5-
//~^ ERROR character literal may only contain one codepoint
4+
println!('●●'); //~ ERROR character literal may only contain one codepoint
5+
//~^ ERROR format argument must be a string literal
66
}

src/test/ui/str/str-as-char.stderr

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
error: character literal may only contain one codepoint
22
--> $DIR/str-as-char.rs:4:14
33
|
4-
LL | println!('●●');
4+
LL | println!('●●'); //~ ERROR character literal may only contain one codepoint
55
| ^^^^
66
help: if you meant to write a `str` literal, use double quotes
77
|
8-
LL | println!("●●");
8+
LL | println!("●●"); //~ ERROR character literal may only contain one codepoint
99
| ^^^^
1010

11-
error: aborting due to previous error
11+
error: format argument must be a string literal
12+
--> $DIR/str-as-char.rs:4:14
13+
|
14+
LL | println!('●●'); //~ ERROR character literal may only contain one codepoint
15+
| ^^^^
16+
help: you might be missing a string literal to format with
17+
|
18+
LL | println!("{}", '●●'); //~ ERROR character literal may only contain one codepoint
19+
| ^^^^^
20+
21+
error: aborting due to 2 previous errors
1222

0 commit comments

Comments
 (0)