'●●' //~ 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
+}
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`.
'\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
+}
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`.
// 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
}
// 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
}
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