-
Couldn't load subscription status.
- Fork 13.9k
Implement SliceIndex for ByteStr
#138381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SliceIndex for ByteStr
#138381
Conversation
This parallels the layout of `core::str`.
|
rustbot has assigned @Mark-Simulacrum. Use |
This comment has been minimized.
This comment has been minimized.
|
LGTM, once it passes CI. |
7ce4590 to
9d379e1
Compare
|
I needed to update snapshots for UI tests. Unfortunately, I think the diagnostics are now slightly worse. If these tests are on stable, they shouldn't be shown I think it's also related to these impls being transitive: the index type implements |
|
@joshtriplett CI passed |
|
@joshtriplett Hey, friendly two-week ping :). Would you mind taking a look at the update since your last review? Thanks! |
|
@joshtriplett Since you approved it, I was told I can @bors r=joshtriplett rollup |
|
@thaliaarchi: 🔑 Insufficient privileges: Not in reviewers |
|
@thaliaarchi: 🔑 Insufficient privileges: not in try users |
|
@bors r=joshtriplett rollup can you open an issue for the diagnostics that got worse afterwards? |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#138368 (KCFI: Add KCFI arity indicator support) - rust-lang#138381 (Implement `SliceIndex` for `ByteStr`) - rust-lang#139092 (Move `fd` into `std::sys`) - rust-lang#139398 (Change notifications for Exploit Mitigations PG) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#138381 - thaliaarchi:bstr-sliceindex, r=joshtriplett Implement `SliceIndex` for `ByteStr` Implement `Index` and `IndexMut` for `ByteStr` in terms of `SliceIndex`. Implement it for the same types that `&[u8]` supports (a superset of those supported for `&str`, which does not have `usize` and `ops::IndexRange`). At the same time, move compare and index traits to a separate file in the `bstr` module, to give it more space to grow as more functionality is added (e.g., iterators and string-like ops). Order the items in `bstr/traits.rs` similarly to `str/traits.rs`. cc `@joshtriplett` `ByteStr`/`ByteString` tracking issue: rust-lang#134915
Opened as #139424. |
…htriplett Implement `SliceIndex` for `ByteStr` Implement `Index` and `IndexMut` for `ByteStr` in terms of `SliceIndex`. Implement it for the same types that `&[u8]` supports (a superset of those supported for `&str`, which does not have `usize` and `ops::IndexRange`). At the same time, move compare and index traits to a separate file in the `bstr` module, to give it more space to grow as more functionality is added (e.g., iterators and string-like ops). Order the items in `bstr/traits.rs` similarly to `str/traits.rs`. cc `@joshtriplett` `ByteStr`/`ByteString` tracking issue: rust-lang#134915
Implement
IndexandIndexMutforByteStrin terms ofSliceIndex. Implement it for the same types that&[u8]supports (a superset of those supported for&str, which does not haveusizeandops::IndexRange).At the same time, move compare and index traits to a separate file in the
bstrmodule, to give it more space to grow as more functionality is added (e.g., iterators and string-like ops). Order the items inbstr/traits.rssimilarly tostr/traits.rs.cc @joshtriplett
ByteStr/ByteStringtracking issue: #134915