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

Add GroupBy and GroupByMut iterators to the slice #51606

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants
@Kerollmops
Copy link
Contributor

Kerollmops commented Jun 17, 2018

This PR propose to add two new methods to the slice, the group_by and group_by_mut. These two will provide a way to iterate over non-overlapping sub-slices of a base slice that are separated by the predicate given by the user (e.g. Partial::eq, |a, b| a.abs() < b.abs()).

An RFC has already been opened.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jun 17, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (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. Due to 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.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jun 17, 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.

[00:04:58] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:58] tidy error: /checkout/src/libcore/slice/mod.rs:3963: line longer than 100 chars
[00:05:00] some tidy checks failed
[00:05:00] 
[00:05:00] 
[00:05:00] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:05:00] 
[00:05:00] 
[00:05:00] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:05:00] Build completed unsuccessfully in 0:01:48
[00:05:00] Build completed unsuccessfully in 0:01:48
[00:05:00] make: *** [tidy] Error 1
[00:05:00] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0f3df89c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0f682dde:start=1529235001557376032,finish=1529235001566097635,duration=8721603
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:00e62ed2
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:101bc604
$ dmesg | grep -i kill

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)

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jun 17, 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.
[01:18:05] ....................................................................................................
[01:18:20] ....................................................................................................
[01:18:36] ....................................................................................................
[01:18:50] ....................................................................................................
[01:19:10] ..........................F.........................................................................
[01:19:27] failures:
[01:19:27] 
[01:19:27] ---- slice/mod.rs - slice::[T]::group_by_mut (line 848) stdout ----
[01:19:27] error[E0308]: mismatched types
[01:19:27] error[E0308]: mismatched types
[01:19:27]   --> slice/mod.rs:855:1
[01:19:27]    |
[01:19:27] 10 | assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
[01:19:27]    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
[01:19:27]    |
[01:19:27]    = note: expected type `std::option::Option<&mut [{integer}]>`
[01:19:27]               found type `std::option::Option<&[{integer}]>`
[01:19:27] 
[01:19:27] error[E0308]: mismatched types
[01:19:27]   --> slice/mod.rs:856:1
[01:19:27]    |
[01:19:27]    |
[01:19:27] 11 | assert_eq!(iter.next(), Some(&[3, 3][..]));
[01:19:27]    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
[01:19:27]    |
[01:19:27]    = note: expected type `std::option::Option<&mut [{integer}]>`
[01:19:27]               found type `std::option::Option<&[{integer}]>`
[01:19:27] 
[01:19:27] error[E0308]: mismatched types
[01:19:27]   --> slice/mod.rs:857:1
[01:19:27]    |
[01:19:27]    |
[01:19:27] 12 | assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
[01:19:27]    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
[01:19:/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release
59904 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/build
59488 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps
56708 ./obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu
56704 ./obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release

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)

@TimNN TimNN added A-allocators and removed A-allocators labels Jun 26, 2018

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Jul 9, 2018

Closing this until the RFC is merged. When the RFC will be merged this will be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.