-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
More methods for str boxes. (reduce Box<[u8]> ↔ Box<str> transmutes) #41258
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
6ab4281
to
294ee7e
Compare
62b6205
to
15a8d38
Compare
116c9be
to
112459d
Compare
Thanks for the PR @clarcharr! Sorry for the delay - half of the team was on spring vacation. @Kimundi or some other reviewer will be looking at your PR soon. |
No problem! Whenever someone gets around to it. :) |
@bors: r=Kimundi |
📌 Commit 112459d has been approved by |
☔ The latest upstream changes (presumably #41411) made this pull request unmergeable. Please resolve the merge conflicts. |
FYI, my PR #41295 just landed which made a couple organizational changes to the Unstable Book. Namely, features are now divided into 'language features' and 'library features' which are different directories, so you'll unfortunately have to address the conflicts. You should be able to just run |
🔒 Merge conflict |
112459d
to
cd605be
Compare
Just rebased! |
src/doc/unstable-book/src/SUMMARY.md
Outdated
@@ -207,6 +207,7 @@ | |||
- [str_checked_slicing](library-features/str-checked-slicing.md) | |||
- [str_escape](library-features/str-escape.md) | |||
- [str_internals](library-features/str-internals.md) | |||
- [str_box_extras](libaryr-features/str-box-extras.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libaryr
😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shhhhhhh
cd605be
to
9a37ac7
Compare
(Rebased a second time and now it passes.) |
Hm so looking this over, I fear that we're getting too aggressive with all of these conversions. For example functions like |
That makes sense! I can remove that function for now if that seems best. |
Ok, let's remove that function. |
9a37ac7
to
717e06f
Compare
Removed for now. I also marked the |
Looks like Travis is failing? |
717e06f
to
c66c6e9
Compare
Hopefully it should be fixed once Travis finishes! |
(Travis passes.) |
@bors: r=Kimundi |
📌 Commit c66c6e9 has been approved by |
More methods for str boxes. (reduce Box<[u8]> ↔ Box<str> transmutes) This is a follow-up to #41096 that adds safer methods for converting between `Box<str>` and `Box<[u8]>`. They're gated under a different feature from the `&mut str` methods because they may be too niche to include in public APIs, although having them internally helps reduce the number of transmutes the standard library uses. What's added: * `From<Box<str>> for Box<[u8]>` * `<Box<str>>::into_boxed_bytes` (just calls `Into::into`) * `alloc::str` (new module) * `from_boxed_utf8` and `from_boxed_utf8_unchecked`, defined in `alloc:str`, exported in `collections::str` * exports `from_utf8_mut` in `collections::str` (missed from previous PR)
☀️ Test successful - status-appveyor, status-travis |
This is a follow-up to #41096 that adds safer methods for converting between
Box<str>
andBox<[u8]>
. They're gated under a different feature from the&mut str
methods because they may be too niche to include in public APIs, although having them internally helps reduce the number of transmutes the standard library uses.What's added:
From<Box<str>> for Box<[u8]>
<Box<str>>::into_boxed_bytes
(just callsInto::into
)alloc::str
(new module)from_boxed_utf8
andfrom_boxed_utf8_unchecked
, defined inalloc:str
, exported incollections::str
from_utf8_mut
incollections::str
(missed from previous PR)