about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-07 10:02:20 +0100
committerGitHub <noreply@github.com>2025-03-07 10:02:20 +0100
commitd9860276b8f4a1361fcf6fff32f523ebb7cfd2b9 (patch)
tree5e8b675164cea22c7dfa8fc1f2ebc604296b8388 /compiler/rustc_codegen_llvm/src/errors.rs
parent458095aa17e3e57ce3feb82bbbd38c6588e06f56 (diff)
parent83407b828bcf5c883b2ab50b958edbcba0738f6a (diff)
downloadrust-d9860276b8f4a1361fcf6fff32f523ebb7cfd2b9.tar.gz
rust-d9860276b8f4a1361fcf6fff32f523ebb7cfd2b9.zip
Rollup merge of #137777 - thaliaarchi:os_string-push-str, r=joboet
Specialize `OsString::push` and `OsString as From` for UTF-8

When concatenating two WTF-8 strings, surrogate pairs at the boundaries need to be joined. However, since UTF-8 strings cannot contain surrogate halves, this check can be skipped when one string is UTF-8. Specialize `OsString::push` to use a more efficient concatenation in this case.

The WTF-8 version of `OsString` tracks whether it is known to be valid UTF-8 with its `is_known_utf8` field. Specialize `From<AsRef<OsStr>>` so this can be set for UTF-8 string types.

Unfortunately, a specialization for `T: AsRef<str>` conflicts with `T: AsRef<OsStr>`, so stamp out string types with a macro.

r? ``@ChrisDenton``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions