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
Contributor

newpavlov commented Jun 26, 2018

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

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Jun 26, 2018

Collaborator

r? @Mark-Simulacrum

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

Collaborator

rust-highfive commented Jun 26, 2018

r? @Mark-Simulacrum

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

@rust-highfive

This comment was marked as outdated.

Show comment
Hide comment
@rust-highfive

rust-highfive Jun 26, 2018

Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Testing alloc stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:04:52]    Compiling libc v0.2.40
[01:04:53]    Compiling rand v0.4.2
[01:04:55]    Compiling alloc v0.0.0 (file:///checkout/src/liballoc)
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 180 |     assert_eq!("ab", unsafe {"abc".slice_unchecked(0, 2)});
[01:05:00]     |
[01:05:00]     |
[01:05:00]     = note: `-D deprecated` implied by `-D warnings`
[01:05:00] 
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 181 |     assert_eq!("bc", unsafe {"abc".slice_unchecked(1, 3)});
[01:05:00] 
[01:05:00] 
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 182 |     assert_eq!("", unsafe {"abc".slice_unchecked(1, 1)});
[01:05:00] 
[01:05:00] 
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 203 |         unsafe { letters.slice_unchecked(0, 500000)});
[01:05:00] 
[01:05:03] error: aborting due to 4 previous errors
[01:05:03] 
[01:05:03] error: Could not compile `alloc`.
[01:05:03] error: Could not compile `alloc`.
[01:05:03] warning: build failed, waiting for other jobs to finish...
[01:05:04] error: build failed
[01:05:04] 
[01:05:04] 
[01:05:04] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--" "--quiet"
[01:05:04] 
[01:05:04] 
[01:05:04] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:05:04] Build completed unsuccessfully in 0:23:49
[01:05:04] Build completed unsuccessfully in 0:23:49
[01:05:04] Makefile:58: recipe for target 'check' failed
[01:05:04] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2aca81aa
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Collaborator

rust-highfive commented Jun 26, 2018

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Testing alloc stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:04:52]    Compiling libc v0.2.40
[01:04:53]    Compiling rand v0.4.2
[01:04:55]    Compiling alloc v0.0.0 (file:///checkout/src/liballoc)
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 180 |     assert_eq!("ab", unsafe {"abc".slice_unchecked(0, 2)});
[01:05:00]     |
[01:05:00]     |
[01:05:00]     = note: `-D deprecated` implied by `-D warnings`
[01:05:00] 
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 181 |     assert_eq!("bc", unsafe {"abc".slice_unchecked(1, 3)});
[01:05:00] 
[01:05:00] 
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 182 |     assert_eq!("", unsafe {"abc".slice_unchecked(1, 1)});
[01:05:00] 
[01:05:00] 
[01:05:00] error: use of deprecated item 'core::str::<impl str>::slice_unchecked': duplicates `get_unchecked`
[01:05:00]     |
[01:05:00]     |
[01:05:00] 203 |         unsafe { letters.slice_unchecked(0, 500000)});
[01:05:00] 
[01:05:03] error: aborting due to 4 previous errors
[01:05:03] 
[01:05:03] error: Could not compile `alloc`.
[01:05:03] error: Could not compile `alloc`.
[01:05:03] warning: build failed, waiting for other jobs to finish...
[01:05:04] error: build failed
[01:05:04] 
[01:05:04] 
[01:05:04] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--" "--quiet"
[01:05:04] 
[01:05:04] 
[01:05:04] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:05:04] Build completed unsuccessfully in 0:23:49
[01:05:04] Build completed unsuccessfully in 0:23:49
[01:05:04] Makefile:58: recipe for target 'check' failed
[01:05:04] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2aca81aa
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Show outdated Hide outdated src/libcore/str/mod.rs
Show outdated Hide outdated src/libcore/str/mod.rs

@kennytm kennytm added the T-libs label Jun 26, 2018

@TimNN

This comment has been minimized.

Show comment
Hide comment
@TimNN

TimNN Jul 3, 2018

Contributor

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

Contributor

TimNN commented Jul 3, 2018

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

@pietroalbini

This comment has been minimized.

Show comment
Hide comment
@pietroalbini

pietroalbini Jul 9, 2018

Member

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

Member

pietroalbini commented Jul 9, 2018

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

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Jul 9, 2018

Contributor

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

@rfcbot fcp merge

Contributor

SimonSapin commented Jul 9, 2018

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

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot 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 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

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Jul 11, 2018

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

rfcbot commented Jul 11, 2018

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

@RalfJung

This comment has been minimized.

Show comment
Hide comment
@RalfJung

RalfJung Jul 12, 2018

Member

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

Member

RalfJung commented Jul 12, 2018

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

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Jul 12, 2018

Contributor

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

Contributor

SimonSapin commented Jul 12, 2018

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

@RalfJung

This comment has been minimized.

Show comment
Hide comment
@RalfJung

RalfJung Jul 12, 2018

Member

oops well, that then :)

Member

RalfJung commented Jul 12, 2018

oops well, that then :)

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Jul 21, 2018

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

rfcbot commented Jul 21, 2018

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

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jul 21, 2018

Member

@bors: r+

Ok great!

Member

alexcrichton commented Jul 21, 2018

@bors: r+

Ok great!

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jul 21, 2018

Contributor

📌 Commit 808bcfb has been approved by alexcrichton

Contributor

bors commented Jul 21, 2018

📌 Commit 808bcfb has been approved by alexcrichton

@kennytm

This comment has been minimized.

Show comment
Hide comment
@kennytm

kennytm Jul 21, 2018

Member

@bors rollup

Member

kennytm commented Jul 21, 2018

@bors rollup

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

Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichton
Deprecation of str::slice_unchecked(_mut)

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`.

bors added a commit that referenced this pull request Jul 21, 2018

Auto merge of #52588 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #51485 (Remove highlighting from secondary messages)
 - #51807 (Deprecation of str::slice_unchecked(_mut))
 - #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size)
 - #52507 (Reword when `_` couldn't be inferred)
 - #52558 (Add tests for ICEs which no longer repro)
 - #52571 (Abort if a promoted fails to be const evaluable and its runtime checks didn't trigger)
 - #52581 (Avoid using `#[macro_export]` for documenting builtin macros)
 - #52582 (Typo)

Failed merges:

r? @ghost

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

Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichton
Deprecation of str::slice_unchecked(_mut)

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`.

bors added a commit that referenced this pull request Jul 21, 2018

Auto merge of #52588 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #51485 (Remove highlighting from secondary messages)
 - #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.)
 - #52558 (Add tests for ICEs which no longer repro)
 - #52581 (Avoid using `#[macro_export]` for documenting builtin macros)
 - #52582 (Typo)
 - #52587 (Add missing backtick in UniversalRegions doc comment)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Jul 22, 2018

Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichton
Deprecation of str::slice_unchecked(_mut)

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`.

bors added a commit that referenced this pull request Jul 22, 2018

Auto merge of #52616 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #51807 (Deprecation of str::slice_unchecked(_mut))
 - #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.)
 - #52558 (Add tests for ICEs which no longer repro)
 - #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.)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jul 22, 2018

Auto merge of #52616 - kennytm:rollup, r=kennytm
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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 14, 2018

rust: Update to 1.29.0.
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