mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
7ea4de9632
Fix suggestion for attempting to define a string with single quotes Currently attempting to compile `fn main() { let _ = '\\"'; }` will result in the following error message: ``` error: character literal may only contain one codepoint --> src/main.rs:1:21 | 1 | fn main() { let _ = '\\"'; } | ^^^^^ | help: if you meant to write a `str` literal, use double quotes | 1 | fn main() { let _ = "\\""; } | ~~~~~ ``` The suggestion is invalid as it fails to escape the `"`. This PR fixes the suggestion so that it now reads: ``` help: if you meant to write a `str` literal, use double quotes | 1 | fn main() { let _ = "\\\""; } | ~~~~~~ ``` The relevant test is also updated to ensure that this does not regress in future. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |