about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorCatherine Flores <catherine.3.flores@gmail.com>2025-01-28 19:29:57 +0000
committerGitHub <noreply@github.com>2025-01-28 19:29:57 +0000
commit6a209cdc9045f6770031de0764217081a176aee6 (patch)
treed2c2409dd8401f7978047c01bdc96785d88c6bbf /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent9ede32fe0057cba9632355cad67d03567cdc6fc0 (diff)
parent65b95a2cfb21daccddba238980b545f82ed8fd35 (diff)
downloadrust-6a209cdc9045f6770031de0764217081a176aee6.tar.gz
rust-6a209cdc9045f6770031de0764217081a176aee6.zip
Fix escaping problem in `write_literal` and `print_literal` lint suggestion (#13990)
fix #13959

The current implementation of the `write_literal` and `print_literal`
lint performs escaping for the second argument of `write!` ,`writeln!`,
`print!` and `println!` of the suggestion by first replacing `"` with
`\"`, and then replacing `\` with `\\`. Performing these replacements in
this order may lead to unnecessary backslashes being added if the
original code contains `"` (e.g. `"` -> `\\"`), potentially resulting in
a suggestion that causes the code to fail to compile.
In the issue mentioned above, it’s suggested to use raw strings as raw
strings, but implementing this would require an ad-hoc change to the
current implementation, so it has been deferred. (I'll implement this in
another PR)

changelog: [`write_literal`]: fix incorrect escaping of suggestions
changelog: [`print_literal`]: fix incorrect escaping of suggestions
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions