Fix tests

This commit is contained in:
Yuki Okushi 2019-01-18 05:24:17 +09:00
parent 8bbb63c600
commit b721c1a885
7 changed files with 67 additions and 11 deletions

View File

@ -3,4 +3,7 @@ static c: char =
'' //~ ERROR: character literal may only contain one codepoint
;
fn main() {}
fn main() {
let ch: &str = ''; //~ ERROR: character literal may only contain one codepoint
//~^ ERROR: mismatched types
}

View File

@ -8,5 +8,25 @@ help: if you meant to write a `str` literal, use double quotes
LL | "●●" //~ ERROR: character literal may only contain one codepoint
| ^^^^
error: aborting due to previous error
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-3.rs:7:20
|
LL | let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
| ^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | let ch: &str = "●●"; //~ ERROR: character literal may only contain one codepoint
| ^^^^
error[E0308]: mismatched types
--> $DIR/lex-bad-char-literals-3.rs:7:20
|
LL | let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
| ^^^^ expected &str, found char
|
= note: expected type `&str`
found type `char`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.

View File

@ -4,4 +4,7 @@ static c: char =
'\x10\x10' //~ ERROR: character literal may only contain one codepoint
;
fn main() {}
fn main() {
let ch: &str = '\x10\x10'; //~ ERROR: character literal may only contain one codepoint
//~^ ERROR: mismatched types
}

View File

@ -8,5 +8,25 @@ help: if you meant to write a `str` literal, use double quotes
LL | "/x10/x10" //~ ERROR: character literal may only contain one codepoint
| ^^^^^^^^^^
error: aborting due to previous error
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-5.rs:8:20
|
LL | let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
| ^^^^^^^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | let ch: &str = "/x10/x10"; //~ ERROR: character literal may only contain one codepoint
| ^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/lex-bad-char-literals-5.rs:8:20
|
LL | let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
| ^^^^^^^^^^ expected &str, found char
|
= note: expected type `&str`
found type `char`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,6 +1,6 @@
// run-rustfix
fn main() {
println!("●●");
//~^ ERROR character literal may only contain one codepoint
println!("{}", "●●"); //~ ERROR character literal may only contain one codepoint
//~^ ERROR format argument must be a string literal
}

View File

@ -1,6 +1,6 @@
// run-rustfix
fn main() {
println!('');
//~^ ERROR character literal may only contain one codepoint
println!(''); //~ ERROR character literal may only contain one codepoint
//~^ ERROR format argument must be a string literal
}

View File

@ -1,12 +1,22 @@
error: character literal may only contain one codepoint
--> $DIR/str-as-char.rs:4:14
|
LL | println!('●●');
LL | println!('●●'); //~ ERROR character literal may only contain one codepoint
| ^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | println!("●●");
LL | println!("●●"); //~ ERROR character literal may only contain one codepoint
| ^^^^
error: aborting due to previous error
error: format argument must be a string literal
--> $DIR/str-as-char.rs:4:14
|
LL | println!('●●'); //~ ERROR character literal may only contain one codepoint
| ^^^^
help: you might be missing a string literal to format with
|
LL | println!("{}", '●●'); //~ ERROR character literal may only contain one codepoint
| ^^^^^
error: aborting due to 2 previous errors