Add some conversion trait impls by Jules-Bertholet · Pull Request #145504 · rust-lang/rust (original) (raw)
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
This change is insta-stable, or significant enough to need a team FCP to proceed.
Relevant to the library API team, which will review and decide on the PR/issue.
and removed T-libs
Relevant to the library team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
This comment has been minimized.
Preparing for crater
@bors try
@rustbot label +I-libs-api-nominated
r? libs
Relevant to the library team, which will review and decide on the PR/issue.
label
This comment has been minimized.
rust-bors bot added a commit that referenced this pull request
…r=
Add some conversion trait impls
Comment on lines 1181 to 1191
| impl AsMut<str> for AsciiChar { |
|---|
| #[inline(always)] |
| fn as_mut(&mut self) -> &mut str { |
| let ascii_ptr: *mut [Self] = crate::slice::from_mut(self); |
| let str_ptr = ascii_ptr as *mut str; |
| // SAFETY: Each ASCII codepoint in UTF-8 is encoded as one single-byte |
| // code unit having the same value as the ASCII byte. |
| unsafe { &mut *str_ptr } |
| } |
| } |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be implemented in a new as_mut_str method, similar to as_str
Also, could everything here use #[inline] without the always?
tgross35 added S-waiting-on-team
DEPRECATED: Use the team-based variants `S-waiting-on-t-lang`, `S-waiting-on-t-compiler`, ...
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
☀️ Try build successful (CI)
Build commit: 0498c15 (0498c157964e0946754e29e57ee9ef4527dc2a42, parent: af00ff2ce62b6617ed19305ae39e135ac71d0b22)
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Relevant to the library team, which will review and decide on the PR/issue.
label
This comment was marked as resolved.
Team member @the8472 has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
🔔 This is now entering its final comment period, as per the review above. 🔔
Can we get rid of my transpose function in favor of the from impl? Seems a bit weird to have both.
I think that dedicated methods are nice because they make things a little clearer than just into(). We're allowed to have both.
The final comment period, with a disposition to merge, as per the review above, is now complete.
As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.
This will be merged soon.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rustbot added the S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
label
Labels
This issue / PR is in PFCP or FCP with a disposition to merge it.
The final comment period is finished for this PR / Issue.
This change is insta-stable, or significant enough to need a team FCP to proceed.
Status: This is awaiting some action (such as code changes or more information) from the author.
Relevant to the library API team, which will review and decide on the PR/issue.
Announce this issue on triage meeting