about summary refs log tree commit diff
path: root/tests/ui/inference/str-as-char.rs
blob: 7680bce03b8b9ab95e8002d797e9d8ef3f2f5ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
// When a char literal is used where a str should be,
// suggest changing to double quotes.

//@ run-rustfix

fn main() {
    let _: &str = 'a';   //~ ERROR mismatched types
    let _: &str = '"""'; //~ ERROR character literal may only contain one codepoint
    let _: &str = '\"\"\"'; //~ ERROR character literal may only contain one codepoint
    let _: &str = '"\"\\"\\\"\\\\"'; //~ ERROR character literal may only contain one codepoint
}