smaller PR just to fix #50002 by ExpHP · Pull Request #50039 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation6 Commits2 Checks0 Files changed

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 }})

ExpHP

I pulled this out of #50010 to make it easier to backport to beta if necessary, considering that inclusive range syntax is stabilizing soon (?).

It fixes a bug in <str>::index_mut with (..=end) ranges (#50002), which prior to this fix was not only unusable but also UB in the cases where it "worked" (it gave improperly truncated UTF-8).

(not that I can imagine why anybody would use <str>::index_mut... but I'm not here to judge)

@ExpHP

@rust-highfive

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.

[00:00:45] configure: rust.quiet-tests     := True
---
[00:59:47] .................................................................................i..................
[00:59:55] ........................i...........................................................................
---
[01:00:49] .....................i...........................................................................i..
[01:00:57] ....................................................................................................
[01:01:05] ...........ii.......................................................................................
[01:01:17] ............................................................................................i.......
---
[01:02:08] .............................................i......................................................
---
[01:07:27] ..............................i.....................................................................
[01:07:45] ...............................................................i....................................
[01:08:05] .................................................i..................................................
[01:08:31] ....................................................................................................
[01:08:59] ....................................................................................................
[01:09:28] ....................................................................................................
[01:10:00] .......i............................................................................................
[01:10:19] ...i.........................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[01:10:48] .......................................................
[01:11:30] ....................................................................................................
[01:12:11] .....................................................................ii.............................
[01:12:59] ................................i.......................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[01:13:22] .............................i.ii...........
[01:14:16] .............................................................................................iiiiiii
---
[01:17:46] ....................i............................................................ii.iii.............
[01:17:55] ....................................................................................................
[01🔞05] .........i..............................i...........................................................
[01🔞15] ....................................................................................................
[01🔞23] ...........i........................................................................................
---
[01:19:36] ....i...............................................................................................
[01:19:47] ........i..ii.......................................................................................
[01:19:59] ....................................................................................................
[01:20:10] ....................................................................................................
[01:20:21] ..........................................................................i.........................
[01:20:33] ....................i...............................................................................
---
[01:21:12] ...........................i........................................................................
[01:21:14] ....................................................................i...............................
[01:21:15] ...............i.......................................................
---
[01:21:36] .............i........................
---
[01:22:11] i...i..ii....i.............ii.........iii......i..i...i...ii..i..i..ii.....
---
[01:22:15] i.......i......................i.......
---
[01:23:05] iiii.......i..i........i..i.i.............i..........iiii...........i...i..........ii.i.i.......ii..
[01:23:07] ....ii...
---
[01:33:54] ..................i.................................................................................
[01:36:00] ........i...........................................................................................
---
[01:37:35] ..........FF........................................................................................
[01:37:39] ........................................................................................
[01:37:39] failures:
[01:37:39]
[01:37:39] ---- str::test_str_slicemut_rangetoinclusive_ok stdout ----
[01:37:39]  thread 'str::test_str_slicemut_rangetoinclusive_ok' panicked at 'byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of `abcαβγ`', libcore/str/mod.rs:2268:5
---
[01:37:39] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--" "--quiet"
[01:37:39] expected success, got: exit code: 101
[01:37:39]
[01:37:39]
[01:37:39] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:37:39] Build completed unsuccessfully in 0:39:30
[01:37:39] make: *** [check] Error 1
[01:37:39] Makefile:58: recipe for target 'check' failed

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)

@pietroalbini

Highfive failed to assign a reviewer for this, assigning the same one as the other PR. r? @bluss

@ExpHP

and add one for non-mut slicing since I touched that method too

@nagisa nagisa added the T-libs-api

Relevant to the library API team, which will review and decide on the PR/issue.

label

Apr 20, 2018

@alexcrichton

@bors: r+ p=1

Thanks @ExpHP and sorry for the delay!

FWIW if you'd like to give similar treatment to all the inclusive range methods here (basically delegate to the other range implementations), that'd be awesome as well!

@bors

📌 Commit 90b361b 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

Apr 21, 2018

@ExpHP ExpHP mentioned this pull request

Apr 21, 2018

@bors

bors added a commit that referenced this pull request

Apr 21, 2018

@bors

smaller PR just to fix #50002

I pulled this out of #50010 to make it easier to backport to beta if necessary, considering that inclusive range syntax is stabilizing soon (?).

It fixes a bug in <str>::index_mut with (..=end) ranges (#50002), which prior to this fix was not only unusable but also UB in the cases where it "worked" (it gave improperly truncated UTF-8).

(not that I can imagine why anybody would use <str>::index_mut... but I'm not here to judge)

@bors

@ExpHP ExpHP deleted the quick-50002 branch

April 21, 2018 21:50

bors added a commit that referenced this pull request

Apr 23, 2018

@bors

[beta] Another round of backports

This is a backport of:

Labels

beta-accepted

Accepted for backporting to the compiler in the beta channel.

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.