Fix tests

This commit is contained in:
Yuki Okushi 2019-01-20 14:53:28 +09:00
parent 6e59c64326
commit 7ce2514419
8 changed files with 56 additions and 96 deletions

View file

@ -1,7 +1,7 @@
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-2.rs:3:5
|
LL | 'nope' //~ ERROR: character literal may only contain one codepoint: 'nope'
LL | 'nope' //~ ERROR: character literal may only contain one codepoint
| ^^^^^^
error[E0601]: `main` function not found in crate `lex_bad_char_literals_2`

View file

@ -1,9 +1,8 @@
// This test needs to the last one appearing in this file as it kills the parser
static c: char =
'' //~ ERROR: character literal may only contain one codepoint
;
static c: char = '';
//~^ ERROR: character literal may only contain one codepoint
fn main() {
let ch: &str = ''; //~ ERROR: character literal may only contain one codepoint
//~^ ERROR: mismatched types
let ch: &str = '';
//~^ ERROR: character literal may only contain one codepoint
}

View file

@ -1,32 +1,22 @@
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-3.rs:3:5
--> $DIR/lex-bad-char-literals-3.rs:1:18
|
LL | '●●' //~ ERROR: character literal may only contain one codepoint
| ^^^^
LL | static c: char = '●●';
| ^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | "●●" //~ ERROR: character literal may only contain one codepoint
| ^^^^
LL | static c: char = "●●";
| ^^^^
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-3.rs:7:20
--> $DIR/lex-bad-char-literals-3.rs:6:20
|
LL | let ch: &str = '●●'; //~ ERROR: character literal may only contain one codepoint
LL | let ch: &str = '●●';
| ^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | let ch: &str = "●●"; //~ ERROR: character literal may only contain one codepoint
LL | let ch: &str = "●●";
| ^^^^
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 2 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,20 +1,8 @@
error: character literal may only contain one codepoint
error: character literal may only contain one codepoint: '●
--> $DIR/lex-bad-char-literals-4.rs:4:5
|
LL | '● //~ ERROR: character literal may only contain one codepoint: '●
LL | '● //~ ERROR: character literal may only contain one codepoint
| ^^
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-4.rs:4:70
|
LL | '● //~ ERROR: character literal may only contain one codepoint: '●
| ^^
error: expected one of `.`, `;`, `?`, or an operator, found `~`
--> $DIR/lex-bad-char-literals-4.rs:4:11
|
LL | '● //~ ERROR: character literal may only contain one codepoint: '●
| ^ expected one of `.`, `;`, `?`, or an operator here
error: aborting due to 3 previous errors
error: aborting due to previous error

View file

@ -1,10 +1,7 @@
//
// This test needs to the last one appearing in this file as it kills the parser
static c: char =
'\x10\x10' //~ ERROR: character literal may only contain one codepoint
;
static c: char = '\x10\x10';
//~^ ERROR: character literal may only contain one codepoint
fn main() {
let ch: &str = '\x10\x10'; //~ ERROR: character literal may only contain one codepoint
//~^ ERROR: mismatched types
let ch: &str = '\x10\x10';
//~^ ERROR: character literal may only contain one codepoint
}

View file

@ -1,32 +1,22 @@
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-5.rs:4:5
--> $DIR/lex-bad-char-literals-5.rs:1:18
|
LL | '/x10/x10' //~ ERROR: character literal may only contain one codepoint
| ^^^^^^^^^^
LL | static c: char = '/x10/x10';
| ^^^^^^^^^^
help: if you meant to write a `str` literal, use double quotes
|
LL | "/x10/x10" //~ ERROR: character literal may only contain one codepoint
| ^^^^^^^^^^
LL | static c: char = "/x10/x10";
| ^^^^^^^^^^
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-5.rs:8:20
--> $DIR/lex-bad-char-literals-5.rs:5:20
|
LL | let ch: &str = '/x10/x10'; //~ ERROR: character literal may only contain one codepoint
LL | let ch: &str = '/x10/x10';
| ^^^^^^^^^^
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
LL | let ch: &str = "/x10/x10";
| ^^^^^^^^^^
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 2 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,12 +1,17 @@
fn main() {
let x: &str = 'ab'; //~ ERROR: character literal may only contain one codepoint
//~^ ERROR: mismatched types
let y: char = 'cd'; //~ ERROR: character literal may only contain one codepoint
let z = 'ef'; //~ ERROR: character literal may only contain one codepoint
let x: &str = 'ab';
//~^ ERROR: character literal may only contain one codepoint
let y: char = 'cd';
//~^ ERROR: character literal may only contain one codepoint
let z = 'ef';
//~^ ERROR: character literal may only contain one codepoint
if x == y {} //~ ERROR: can't compare `&str` with `char`
if x == y {}
//~^ ERROR: can't compare `&str` with `char`
if y == z {} // no error here
if x == z {} //~ ERROR: can't compare `&str` with `char`
if x == z {}
//~^ ERROR: can't compare `&str` with `char`
let a: usize = ""; //~ ERROR: mismatched types
}
let a: usize = "";
//~^ ERROR: mismatched types
}

View file

@ -1,56 +1,47 @@
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-6.rs:2:19
|
LL | let x: &str = 'ab'; //~ ERROR: character literal may only contain one codepoint
LL | let x: &str = 'ab';
| ^^^^
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-6.rs:3:19
--> $DIR/lex-bad-char-literals-6.rs:4:19
|
LL | let y: char = 'cd'; //~ ERROR: character literal may only contain one codepoint
LL | let y: char = 'cd';
| ^^^^
error: character literal may only contain one codepoint
--> $DIR/lex-bad-char-literals-6.rs:4:13
--> $DIR/lex-bad-char-literals-6.rs:6:13
|
LL | let z = 'ef'; //~ ERROR: character literal may only contain one codepoint
LL | let z = 'ef';
| ^^^^
error[E0308]: mismatched types
--> $DIR/lex-bad-char-literals-6.rs:2:19
|
LL | let x: &str = 'ab'; //~ ERROR: character literal may only contain one codepoint
| ^^^^ expected &str, found char
|
= note: expected type `&str`
found type `char`
error[E0277]: can't compare `&str` with `char`
--> $DIR/lex-bad-char-literals-6.rs:6:10
--> $DIR/lex-bad-char-literals-6.rs:9:10
|
LL | if x == y {} // no error here
LL | if x == y {}
| ^^ no implementation for `&str == char`
|
= help: the trait `std::cmp::PartialEq<char>` is not implemented for `&str`
error[E0308]: mismatched types
--> $DIR/lex-bad-char-literals-6.rs:10:20
--> $DIR/lex-bad-char-literals-6.rs:15:20
|
LL | let a: usize = ""; // type error here to confirm we got past the parser
LL | let a: usize = "";
| ^^ expected usize, found reference
|
= note: expected type `usize`
found type `&'static str`
error[E0277]: can't compare `&str` with `char`
--> $DIR/lex-bad-char-literals-6.rs:8:10
--> $DIR/lex-bad-char-literals-6.rs:12:10
|
LL | if x == z {} // no error here
LL | if x == z {}
| ^^ no implementation for `&str == char`
|
= help: the trait `std::cmp::PartialEq<char>` is not implemented for `&str`
error: aborting due to 7 previous errors
error: aborting due to 6 previous errors
Some errors occurred: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.