about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/errors.rs
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-01-02 22:37:03 +0200
committerJosh Triplett <josh@joshtriplett.org>2025-01-11 06:35:21 +0200
commit2808977e053c47c8fee731432f9c91a8581fad96 (patch)
tree6258fea325dbbc85e8276ccd068bc3a09fc1f3ad /compiler/rustc_interface/src/errors.rs
parent7648efaf1a26aaec38d3babfdd26df1bc8648222 (diff)
downloadrust-2808977e053c47c8fee731432f9c91a8581fad96.tar.gz
rust-2808977e053c47c8fee731432f9c91a8581fad96.zip
Implement `ByteStr` and `ByteString` types
Approved ACP: https://github.com/rust-lang/libs-team/issues/502
Tracking issue: https://github.com/rust-lang/rust/issues/134915

These types represent human-readable strings that are conventionally,
but not always, UTF-8. The `Debug` impl prints non-UTF-8 bytes using
escape sequences, and the `Display` impl uses the Unicode replacement
character.

This is a minimal implementation of these types and associated trait
impls. It does not add any helper methods to other types such as `[u8]`
or `Vec<u8>`.

I've omitted a few implementations of `AsRef`, `AsMut`, `Borrow`,
`From`, and `PartialOrd`, when those would be the second implementation
for a type (counting the `T` impl) or otherwise may cause inference
failures. These impls are important, but we can attempt to add them
later in standalone commits, and run them through crater.

In addition to the `bstr` feature, I've added a `bstr_internals` feature
for APIs provided by `core` for use by `alloc` but not currently
intended for stabilization.

This API and its implementation are based *heavily* on the `bstr` crate
by Andrew Gallant (@BurntSushi).
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions