summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lexer/lex-bad-char-literals-6.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/lexer/lex-bad-char-literals-6.rs')
-rw-r--r--src/test/ui/lexer/lex-bad-char-literals-6.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.rs b/src/test/ui/lexer/lex-bad-char-literals-6.rs
new file mode 100644
index 000000000..4379b4fa6
--- /dev/null
+++ b/src/test/ui/lexer/lex-bad-char-literals-6.rs
@@ -0,0 +1,17 @@
+fn main() {
+ 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 y == z {} // no error here
+ if x == z {}
+ //~^ ERROR: can't compare `&str` with `char`
+
+ let a: usize = "";
+ //~^ ERROR: mismatched types
+}