Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement DerefMut for String #26241
Conversation
rust-highfive
assigned
aturon
Jun 12, 2015
This comment has been minimized.
This comment has been minimized.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
|
Is it also time to look at either deprecating or stabilizing |
This comment has been minimized.
This comment has been minimized.
|
Those casing ascii methods are pretty broken in unicode context, but I guess we could allow arbitrary ascii -> ascii mappings. Since a grapheme can be multiple codepoints, this also edits / transforms graphemes that use at least one ascii codepoint, for example é (depending on normalization). |
This comment has been minimized.
This comment has been minimized.
|
@bluss Agreed, the |
This comment has been minimized.
This comment has been minimized.
|
I would be more uncomfortable with stabilizing |
alexcrichton
added
I-needs-decision
T-libs
labels
Jun 12, 2015
This comment has been minimized.
This comment has been minimized.
|
OK. |
This comment has been minimized.
This comment has been minimized.
|
I say we just land DerefMut and call it a day. Other stuff is easy to impl outside std. |
brson
added
the
relnotes
label
Jun 12, 2015
This comment has been minimized.
This comment has been minimized.
|
I don't want to complicate this issue, but we might want to add slicing of |
This comment has been minimized.
This comment has been minimized.
|
Added a commit:
|
SimonSapin
force-pushed the
SimonSapin:derefmut-for-string
branch
from
a61076a
to
ef8ac71
Jun 15, 2015
This comment has been minimized.
This comment has been minimized.
|
I'm |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Hm, I was also forgetting that implementations of stable traits are instantly stable regardless. I'm happy with the PR as it stands. |
alexcrichton
added
final-comment-period
and removed
I-needs-decision
labels
Jun 16, 2015
This comment has been minimized.
This comment has been minimized.
|
This PR is now entering its final comment period. There was some discussion at triage today about this and there was some hesitation about the power that |
This comment has been minimized.
This comment has been minimized.
|
After seeing #9750 again I’ve been pondering on whether this PR introduces a way to break the UTF-8 invariant in safe code. I believe it does not:
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
I’ll rebase once a decision is made on what to include or not. |
alexcrichton
reviewed
Jul 1, 2015
| @@ -806,6 +814,12 @@ impl str { | |||
| core_str::StrExt::split_at(self, mid) | |||
| } | |||
|
|
|||
| /// Divide one mutable string slice into two at an index. | |||
| #[inline] | |||
| pub fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) { | |||
This comment has been minimized.
This comment has been minimized.
alexcrichton
reviewed
Jul 1, 2015
| /// Takes a bytewise mutable slice from a string. | ||
| /// | ||
| /// Same as `slice_unchecked`, but works with `&mut str` instead of `&str`. | ||
| #[stable(feature = "derefmut_for_string", since = "1.2.0")] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The consensus of the libs team is to move ahead with this PR, with a rebase and a few nits addressed this should be good to go, thanks @SimonSapin! |
alexcrichton
removed
the
final-comment-period
label
Jul 1, 2015
SimonSapin
force-pushed the
SimonSapin:derefmut-for-string
branch
from
285feb6
to
28357e5
Jul 1, 2015
This comment has been minimized.
This comment has been minimized.
|
Rebased and added a commit to address comments. This commits also adds I’m getting an LLVM assertion error when building locally :( Could this be specific to stage1? I haven’t tried stage2 yet.
|
SimonSapin
force-pushed the
SimonSapin:derefmut-for-string
branch
from
28357e5
to
23daca3
Jul 1, 2015
This comment has been minimized.
This comment has been minimized.
|
I’m still getting the same LLVM error after rebasing on today’s Rust master. Any suggestion what to do here? |
This comment has been minimized.
This comment has been minimized.
|
Unfortunately I don't know how to get past that error. |
SimonSapin
added some commits
Jun 12, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
After discussion with @SimonSapin I am interpreting this statement from @alexcrichton
as an implicit |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
doener on IRC suggested that I might be hitting #26484. After running |
SimonSapin
force-pushed the
SimonSapin:derefmut-for-string
branch
from
23daca3
to
eb99f0e
Jul 13, 2015
This comment has been minimized.
This comment has been minimized.
|
I just pushed a rebase. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jul 13, 2015
This comment has been minimized.
This comment has been minimized.
|
|
SimonSapin
force-pushed the
SimonSapin:derefmut-for-string
branch
from
88fe063
to
3226858
Jul 13, 2015
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton With that last commit |
SimonSapin commentedJun 12, 2015
See rust-lang/rfcs#1157