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

12 lines
508 B
Rust
Raw Normal View History

2019-01-19 13:37:58 -06:00
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
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`
let a: usize = ""; //~ ERROR: mismatched types
}