Skip to content
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

Deprecation of str::slice_unchecked(_mut) #51807

Merged
merged 4 commits into from
Jul 22, 2018

Conversation

newpavlov
Copy link
Contributor

Closes #51715

I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0.

Additionally I've replaced slice_unchecked uses with get_unchecked. The only places where this method is still used are src/liballoc/tests/str.rs and src/liballoc/tests/str.rs.

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 26, 2018
@rust-highfive

This comment has been minimized.

@@ -2453,6 +2453,7 @@ impl str {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.28.0", reason = "duplicates `get_unchecked`")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version

It should be 1.29.0 (or higher).

@@ -2483,6 +2484,7 @@ impl str {
/// * `begin` and `end` must be byte positions within the string slice.
/// * `begin` and `end` must lie on UTF-8 sequence boundaries.
#[stable(feature = "str_slice_mut", since = "1.5.0")]
#[rustc_deprecated(since = "1.28.0", reason = "duplicates `get_unchecked`")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_unchecked_mut.

@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jun 26, 2018
@TimNN
Copy link
Contributor

TimNN commented Jul 3, 2018

Ping from triage, @Mark-Simulacrum, this PR needs your review!

@pietroalbini
Copy link
Member

Ping from triage! This PR needs a review, can @Mark-Simulacrum or someone else from @rust-lang/libs review this?

@SimonSapin
Copy link
Contributor

Looks fine to me, but since this is affecting stable APIs let’s go through the process:

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Jul 9, 2018

Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), 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.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 9, 2018
@kennytm kennytm added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2018
@rfcbot
Copy link

rfcbot commented Jul 11, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jul 11, 2018
@kennytm kennytm added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Jul 11, 2018
@alexcrichton alexcrichton added the relnotes Marks issues that should be documented in the release notes of the next release. label Jul 11, 2018
@RalfJung
Copy link
Member

The deprecation message could indicate that one can call get_unchecked(start..len), which was not immediately obvious to me.

@SimonSapin
Copy link
Contributor

Yes, except it’s start..end :)

@RalfJung
Copy link
Member

oops well, that then :)

@rfcbot rfcbot added the finished-final-comment-period The final comment period is finished for this PR / Issue. label Jul 21, 2018
@rfcbot rfcbot removed the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Jul 21, 2018
@rfcbot
Copy link

rfcbot commented Jul 21, 2018

The final comment period, with a disposition to merge, as per the review above, is now complete.

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Jul 21, 2018
@alexcrichton
Copy link
Member

@bors: r+

Ok great!

@bors
Copy link
Contributor

bors commented Jul 21, 2018

📌 Commit 808bcfb has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 21, 2018
@kennytm
Copy link
Member

kennytm commented Jul 21, 2018

@bors rollup

kennytm added a commit to kennytm/rust that referenced this pull request Jul 21, 2018
…excrichton

Deprecation of str::slice_unchecked(_mut)

Closes rust-lang#51715

I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0.

Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.
kennytm added a commit to kennytm/rust that referenced this pull request Jul 22, 2018
…excrichton

Deprecation of str::slice_unchecked(_mut)

Closes rust-lang#51715

I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0.

Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.
bors added a commit that referenced this pull request Jul 22, 2018
Rollup of 11 pull requests

Successful merges:

 - #51807 (Deprecation of str::slice_unchecked(_mut))
 - #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size)
 - #52465 (Add CI test harness for `thumb*` targets. [IRR-2018-embedded])
 - #52507 (Reword when `_` couldn't be inferred)
 - #52508 (Document that Unique::empty() and NonNull::dangling() aren't sentinel values)
 - #52521 (Fix links in rustdoc book.)
 - #52581 (Avoid using `#[macro_export]` for documenting builtin macros)
 - #52582 (Typo)
 - #52587 (Add missing backtick in UniversalRegions doc comment)
 - #52594 (Run the error index tool against the sysroot libdir)
 - #52615 (Added new lines to .gitignore.)
@bors bors merged commit 808bcfb into rust-lang:master Jul 22, 2018
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 14, 2018
Version 1.29.0 (2018-09-13)
==========================

Compiler
--------
- [Bumped minimum LLVM version to 5.0.][51899]
- [Added `powerpc64le-unknown-linux-musl` target.][51619]
- [Added `aarch64-unknown-hermit` and `x86_64-unknown-hermit` targets.][52861]

Libraries
---------
- [`Once::call_once` now no longer requires `Once` to be `'static`.][52239]
- [`BuildHasherDefault` now implements `PartialEq` and `Eq`.][52402]
- [`Box<CStr>`, `Box<OsStr>`, and `Box<Path>` now implement `Clone`.][51912]
- [Implemented `PartialEq<&str>` for `OsString` and `PartialEq<OsString>`
  for `&str`.][51178]
- [`Cell<T>` now allows `T` to be unsized.][50494]
- [`SocketAddr` is now stable on Redox.][52656]

Stabilized APIs
---------------
- [`Arc::downcast`]
- [`Iterator::flatten`]
- [`Rc::downcast`]

Cargo
-----
- [Cargo can silently fix some bad lockfiles ][cargo/5831] You can use
  `--locked` to disable this behaviour.
- [`cargo-install` will now allow you to cross compile an install
  using `--target`][cargo/5614]
- [Added the `cargo-fix` subcommand to automatically move project code from
  2015 edition to 2018.][cargo/5723]

Misc
----
- [`rustdoc` now has the `--cap-lints` option which demotes all lints above
  the specified level to that level.][52354] For example `--cap-lints warn`
  will demote `deny` and `forbid` lints to `warn`.
- [`rustc` and `rustdoc` will now have the exit code of `1` if compilation
  fails, and `101` if there is a panic.][52197]
- [A preview of clippy has been made available through rustup.][51122]
  You can install the preview with `rustup component add clippy-preview`

Compatibility Notes
-------------------
- [`str::{slice_unchecked, slice_unchecked_mut}` are now deprecated.][51807]
  Use `str::get_unchecked(begin..end)` instead.
- [`std::env::home_dir` is now deprecated for its unintuitive behaviour.][51656]
  Consider using the `home_dir` function from
  https://crates.io/crates/dirs instead.
- [`rustc` will no longer silently ignore invalid data in target spec.][52330]

[52861]: rust-lang/rust#52861
[52656]: rust-lang/rust#52656
[52239]: rust-lang/rust#52239
[52330]: rust-lang/rust#52330
[52354]: rust-lang/rust#52354
[52402]: rust-lang/rust#52402
[52103]: rust-lang/rust#52103
[52197]: rust-lang/rust#52197
[51807]: rust-lang/rust#51807
[51899]: rust-lang/rust#51899
[51912]: rust-lang/rust#51912
[51511]: rust-lang/rust#51511
[51619]: rust-lang/rust#51619
[51656]: rust-lang/rust#51656
[51178]: rust-lang/rust#51178
[51122]: rust-lang/rust#51122
[50494]: rust-lang/rust#50494
[cargo/5614]: rust-lang/cargo#5614
[cargo/5723]: rust-lang/cargo#5723
[cargo/5831]: rust-lang/cargo#5831
[`Arc::downcast`]: https://doc.rust-lang.org/std/sync/struct.Arc.html#method.downcast
[`Iterator::flatten`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.flatten
[`Rc::downcast`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.downcast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.