Closed
Description
Consider the following example:
fn main() {
// mismatched types expected `char`, found `&str` rustc(E0308)
let my_character: char = "s";
}
The compiler could be more friendly in this case, having a diagnostic for suggesting using single quotes when people confuse single character strings with char literals. Something like this:
note: character literals are delimited by single quotes
--> main.rs:3:4
|
3 | let my_character: char = 's';
| ---
| |
| use single quotes here
This could help new Rust devs coming from languages where there are no distinction between these things. (Python, Javascript, etc.)