rust/tests/ui/inference/str-as-char.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
443 B
Rust
Raw Normal View History

// When a char literal is used where a str should be,
// suggest changing to double quotes.
//@ run-rustfix
fn main() {
2022-10-22 01:37:20 +00:00
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
}