about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-03 18:29:20 +0000
committerbors <bors@rust-lang.org>2024-09-03 18:29:20 +0000
commitf2ef26d239efbe2a229ad663d4ea8b4411f65b2b (patch)
tree0b67ddf24982ef65fcea0edb1746010888eb190d /compiler/rustc_codegen_llvm/src
parente8ba5d1f7146e5b634b7ea34a02a0c30f0f56da9 (diff)
parenta5e3a3f9b6bd85611fa098dab8948ecdcac98acc (diff)
downloadrust-f2ef26d239efbe2a229ad663d4ea8b4411f65b2b.tar.gz
rust-f2ef26d239efbe2a229ad663d4ea8b4411f65b2b.zip
Auto merge of #13263 - y21:warn_manual_c_str_literals, r=Centri3
move `manual_c_str_literals` to complexity

IMO the suggestion to use `c""` literals over a hardcoded `\0` byte string literal has some fairly strong upsides (no need to manually null-terminate it and the compiler checks for intermediary null bytes) that this should just be enabled by default.

It's also written slightly conservatively to only emit a warning when we can be reasonably confident that the lint is *actually* applicable (that is, lint on e.g. `b"foo\0".as_ptr()` but not `b"foo\0"`. The latter looks like a c-string but its type is `&[u8; _]`, and if it's used in a context where a byte slice is needed then you have no nice way to convert to it from a `c"foo"` literal of type `&CStr`).

changelog: move [`manual_c_str_literals`] to complexity (now warn-by-default)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions