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

implement sort for VecDeque #69400

Closed
wants to merge 4 commits into from
Closed

implement sort for VecDeque #69400

wants to merge 4 commits into from

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Feb 23, 2020

closes #27322.

I have currently only implemented sort_by. If this change is desired,
I will gladly add the other sort methods:

  • sort
  • sort_by_key,
  • sort_by_cached_key
  • sort_unstable
  • sort_unstable_by
  • sort_unstable_by_key

@rust-highfive
Copy link
Collaborator

r? @KodrAus

(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 Feb 23, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Feb 23, 2020

An alternative implementation may not need one continuous slice.
Even as rearranging is not guaranteed right now, it is still observable
and may therefore be depended on.

This could be prevented by changing the deque to not be continuous after sorting:

pub fn sort_by<F>(&mut self, compare: F)
where
    F: FnMut(&T, &T) -> Ordering,
{
    self.make_continuous();

    self.as_mut_slices().0.sort_by(compare);

    if self.len() % 3 == 1 { 
        self.make_noncontinuous();
    }
}

@lcnr lcnr force-pushed the deque_sort branch 2 times, most recently from 0d50d93 to 9f43c18 Compare February 23, 2020 16:06
@lcnr
Copy link
Contributor Author

lcnr commented Feb 23, 2020

I temporarily added ignore-tidy-filelength as vec_deque.rs now has over 3000 lines.

I think that it would be easiest to move struct Iter and struct Drain into a submodule,
should I do this?

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, 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.
2020-02-23T16:13:47.4961477Z ========================== Starting Command Output ===========================
2020-02-23T16:13:47.4964235Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/4c41cff2-33ce-4895-9137-335360de6b31.sh
2020-02-23T16:13:47.4964622Z 
2020-02-23T16:13:47.4968347Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-23T16:13:47.5043537Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69400/merge to s
2020-02-23T16:13:47.5048156Z Task         : Get sources
2020-02-23T16:13:47.5048568Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-23T16:13:47.5048808Z Version      : 1.0.0
2020-02-23T16:13:47.5049397Z Author       : Microsoft
---
2020-02-23T16:13:48.5102027Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-23T16:13:48.5108000Z ##[command]git config gc.auto 0
2020-02-23T16:13:48.5111640Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-23T16:13:48.5114548Z ##[command]git config --get-all http.proxy
2020-02-23T16:13:48.5121031Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69400/merge:refs/remotes/pull/69400/merge
---
2020-02-23T17:17:01.6352967Z .................................................................................................... 1700/9696
2020-02-23T17:17:06.2589871Z .................................................................................................... 1800/9696
2020-02-23T17:17:17.8037409Z ...........................................i........................................................ 1900/9696
2020-02-23T17:17:25.8766528Z .................................................................................................... 2000/9696
2020-02-23T17:17:39.9959725Z .................................iiiii.............................................................. 2100/9696
2020-02-23T17:17:50.0577522Z .................................................................................................... 2300/9696
2020-02-23T17:17:52.5077454Z .................................................................................................... 2400/9696
2020-02-23T17:17:56.9149092Z .................................................................................................... 2500/9696
2020-02-23T17:18:17.5558362Z .................................................................................................... 2600/9696
---
2020-02-23T17:21:00.7594813Z .........i.......................................................................................... 5000/9696
2020-02-23T17:21:10.0831351Z .................................................................................................... 5100/9696
2020-02-23T17:21:14.8969647Z ....................................i............................................................... 5200/9696
2020-02-23T17:21:24.8637396Z .................................................................................................... 5300/9696
2020-02-23T17:21:30.7529275Z ............ii.ii........i...i...................................................................... 5400/9696
2020-02-23T17:21:39.5161957Z .................................................................................................... 5600/9696
2020-02-23T17:21:50.4005148Z .................................................................................................... 5700/9696
2020-02-23T17:21:57.5468684Z ...i................................................................................................ 5800/9696
2020-02-23T17:22:03.3415487Z .................................................................................................... 5900/9696
2020-02-23T17:22:03.3415487Z .................................................................................................... 5900/9696
2020-02-23T17:22:13.3431672Z ..............................................................................................ii...i 6000/9696
2020-02-23T17:22:25.5094427Z ..ii...........i.................................................................................... 6100/9696
2020-02-23T17:22:42.4332205Z .................................................................................................... 6300/9696
2020-02-23T17:22:49.1368832Z .................................................................................................... 6400/9696
2020-02-23T17:22:49.1368832Z .................................................................................................... 6400/9696
2020-02-23T17:23:04.7089952Z .........................i..ii...................................................................... 6500/9696
2020-02-23T17:23:25.1646860Z .................................................................................................... 6700/9696
2020-02-23T17:23:27.4293119Z .................i.................................................................................. 6800/9696
2020-02-23T17:23:29.6406410Z .................................................................................................... 6900/9696
2020-02-23T17:23:32.1428391Z .......................................i............................................................ 7000/9696
---
2020-02-23T17:25:13.0150611Z .................................................................................................... 7700/9696
2020-02-23T17:25:17.8958438Z .................................................................................................... 7800/9696
2020-02-23T17:25:24.2200219Z ...................................................................................i................ 7900/9696
2020-02-23T17:25:32.9651317Z .................................................................................................... 8000/9696
2020-02-23T17:25:40.0466040Z ................................iiiiiii.i........................................................... 8100/9696
2020-02-23T17:25:54.5001715Z .................................................................................................... 8300/9696
2020-02-23T17:26:02.7757799Z .................................................................................................... 8400/9696
2020-02-23T17:26:16.2845887Z .................................................................................................... 8500/9696
2020-02-23T17:26:22.9791557Z .................................................................................................... 8600/9696
---
2020-02-23T17:28:46.3641149Z  finished in 7.707
2020-02-23T17:28:46.3852163Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T17:28:46.6055828Z 
2020-02-23T17:28:46.6056211Z running 178 tests
2020-02-23T17:28:49.5317971Z iiii......i...........ii..iiii...i....i...........i............i..i..................i....i......... 100/178
2020-02-23T17:28:51.7755609Z ...i.i.i...iii..iiiiiiiiiiiiiiii.......................iii............ii......
2020-02-23T17:28:51.7762514Z 
2020-02-23T17:28:51.7767464Z  finished in 5.391
2020-02-23T17:28:51.7936291Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T17:28:51.9489519Z 
---
2020-02-23T17:28:53.9147718Z  finished in 2.121
2020-02-23T17:28:53.9345475Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T17:28:54.0836701Z 
2020-02-23T17:28:54.0839382Z running 9 tests
2020-02-23T17:28:54.0840967Z iiiiiiiii
2020-02-23T17:28:54.0843299Z 
2020-02-23T17:28:54.0843978Z  finished in 0.149
2020-02-23T17:28:54.1034305Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T17:28:54.2954996Z 
---
2020-02-23T17:29:14.8657141Z  finished in 20.762
2020-02-23T17:29:14.8900841Z Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T17:29:15.1170218Z 
2020-02-23T17:29:15.1170549Z running 116 tests
2020-02-23T17:29:28.9016723Z iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii..........i.....i..i.......ii.i.ii. 100/116
2020-02-23T17:29:30.8107805Z ....iiii.....ii.
2020-02-23T17:29:30.8110971Z 
2020-02-23T17:29:30.8115297Z  finished in 15.921
2020-02-23T17:29:30.8121886Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T17:29:30.8122673Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2020-02-23T17:41:53.9634622Z ---- collections/vec_deque.rs - collections::vec_deque::VecDeque<T>::sort_by (line 2167) stdout ----
2020-02-23T17:41:53.9635013Z error: unnecessary trailing semicolon
2020-02-23T17:41:53.9635499Z  --> collections/vec_deque.rs:2170:61
2020-02-23T17:41:53.9635672Z   |
2020-02-23T17:41:53.9635907Z 6 | let mut v: VecDeque<u32> = [5, 4, 1, 3, 2].iter().collect();;
2020-02-23T17:41:53.9636580Z   |
2020-02-23T17:41:53.9636896Z note: the lint level is defined here
2020-02-23T17:41:53.9637837Z  --> collections/vec_deque.rs:2166:9
2020-02-23T17:41:53.9638021Z   |
2020-02-23T17:41:53.9638021Z   |
2020-02-23T17:41:53.9638806Z 2 | #![deny(warnings)]
2020-02-23T17:41:53.9639003Z   |         ^^^^^^^^
2020-02-23T17:41:53.9639248Z   = note: `#[deny(redundant_semicolon)]` implied by `#[deny(warnings)]`
2020-02-23T17:41:53.9641613Z error[E0658]: use of unstable library feature 'vecdeque_sort'
2020-02-23T17:41:53.9642445Z  --> collections/vec_deque.rs:2172:3
2020-02-23T17:41:53.9642641Z   |
2020-02-23T17:41:53.9642641Z   |
2020-02-23T17:41:53.9642816Z 8 | v.sort_by(|a, b| a.cmp(b));
2020-02-23T17:41:53.9643468Z   |
2020-02-23T17:41:53.9645054Z   = help: add `#![feature(vecdeque_sort)]` to the crate attributes to enable
2020-02-23T17:41:53.9648853Z 
2020-02-23T17:41:53.9648853Z 
2020-02-23T17:41:53.9649385Z error[E0277]: a value of type `std::collections::VecDeque<u32>` cannot be built from an iterator over elements of type `&{integer}`
2020-02-23T17:41:53.9650442Z  --> collections/vec_deque.rs:2170:51
2020-02-23T17:41:53.9650646Z   |
2020-02-23T17:41:53.9650864Z 6 | let mut v: VecDeque<u32> = [5, 4, 1, 3, 2].iter().collect();;
2020-02-23T17:41:53.9651407Z   |                                                   ^^^^^^^ value of type `std::collections::VecDeque<u32>` cannot be built from `std::iter::Iterator<Item=&{integer}>`
2020-02-23T17:41:53.9651857Z   |
2020-02-23T17:41:53.9652189Z   = help: the trait `std::iter::FromIterator<&{integer}>` is not implemented for `std::collections::VecDeque<u32>`
2020-02-23T17:41:53.9652499Z 
2020-02-23T17:41:53.9653003Z error[E0277]: a value of type `std::collections::VecDeque<u32>` cannot be built from an iterator over elements of type `&{integer}`
2020-02-23T17:41:53.9653898Z  --> collections/vec_deque.rs:2173:54
2020-02-23T17:41:53.9654077Z   |
2020-02-23T17:41:53.9654279Z 9 | let expected: VecDeque<u32> = [1, 2, 3, 4, 5].iter().collect();
2020-02-23T17:41:53.9654780Z   |                                                      ^^^^^^^ value of type `std::collections::VecDeque<u32>` cannot be built from `std::iter::Iterator<Item=&{integer}>`
2020-02-23T17:41:53.9655194Z   |
2020-02-23T17:41:53.9655669Z   = help: the trait `std::iter::FromIterator<&{integer}>` is not implemented for `std::collections::VecDeque<u32>`
2020-02-23T17:41:53.9656375Z error[E0658]: use of unstable library feature 'vecdeque_sort'
2020-02-23T17:41:53.9656757Z   --> collections/vec_deque.rs:2177:3
2020-02-23T17:41:53.9656918Z    |
2020-02-23T17:41:53.9656918Z    |
2020-02-23T17:41:53.9657082Z 13 | v.sort_by(|a, b| b.cmp(a));
2020-02-23T17:41:53.9657361Z    |
2020-02-23T17:41:53.9657578Z    = help: add `#![feature(vecdeque_sort)]` to the crate attributes to enable
2020-02-23T17:41:53.9657791Z 
2020-02-23T17:41:53.9657791Z 
2020-02-23T17:41:53.9658089Z error[E0277]: a value of type `std::collections::VecDeque<u32>` cannot be built from an iterator over elements of type `&{integer}`
2020-02-23T17:41:53.9658724Z   --> collections/vec_deque.rs:2178:54
2020-02-23T17:41:53.9658908Z    |
2020-02-23T17:41:53.9659114Z 14 | let expected: VecDeque<u32> = [5, 4, 3, 2, 1].iter().collect();
2020-02-23T17:41:53.9659618Z    |                                                      ^^^^^^^ value of type `std::collections::VecDeque<u32>` cannot be built from `std::iter::Iterator<Item=&{integer}>`
2020-02-23T17:41:53.9660037Z    |
2020-02-23T17:41:53.9660341Z    = help: the trait `std::iter::FromIterator<&{integer}>` is not implemented for `std::collections::VecDeque<u32>`
2020-02-23T17:41:53.9660797Z error: aborting due to 6 previous errors
2020-02-23T17:41:53.9660936Z 
2020-02-23T17:41:53.9661120Z Some errors have detailed explanations: E0277, E0658.
2020-02-23T17:41:53.9661587Z For more information about an error, try `rustc --explain E0277`.
---
2020-02-23T17:41:53.9802150Z   local time: Sun Feb 23 17:41:53 UTC 2020
2020-02-23T17:41:54.5336479Z   network time: Sun, 23 Feb 2020 17:41:54 GMT
2020-02-23T17:41:54.5341314Z == end clock drift check ==
2020-02-23T17:41:55.0582803Z 
2020-02-23T17:41:55.0668254Z ##[error]Bash exited with code '1'.
2020-02-23T17:41:55.0684874Z ##[section]Finishing: Run build
2020-02-23T17:41:55.0728421Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69400/merge to s
2020-02-23T17:41:55.0733328Z Task         : Get sources
2020-02-23T17:41:55.0733656Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-23T17:41:55.0733943Z Version      : 1.0.0
2020-02-23T17:41:55.0734152Z Author       : Microsoft
2020-02-23T17:41:55.0734152Z Author       : Microsoft
2020-02-23T17:41:55.0734476Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-23T17:41:55.0734842Z ==============================================================================
2020-02-23T17:41:55.4101020Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-23T17:41:55.4149668Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69400/merge to s
2020-02-23T17:41:55.4233195Z Cleaning up task key
2020-02-23T17:41:55.4234288Z Start cleaning up orphan processes.
2020-02-23T17:41:55.4398057Z Terminate orphan process: pid (3543) (python)
2020-02-23T17:41:55.4658226Z ##[section]Finishing: Finalize Job

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
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, 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.
2020-02-23T17:57:32.3299428Z ========================== Starting Command Output ===========================
2020-02-23T17:57:32.3302246Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/62497e3f-6249-4d0f-8ded-cd5adaecbf09.sh
2020-02-23T17:57:32.3302661Z 
2020-02-23T17:57:32.3307449Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-23T17:57:32.3328081Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69400/merge to s
2020-02-23T17:57:32.3331018Z Task         : Get sources
2020-02-23T17:57:32.3331262Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-23T17:57:32.3331494Z Version      : 1.0.0
2020-02-23T17:57:32.3331649Z Author       : Microsoft
---
2020-02-23T17:57:33.3406872Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-23T17:57:33.3411167Z ##[command]git config gc.auto 0
2020-02-23T17:57:33.3421199Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-23T17:57:33.3429621Z ##[command]git config --get-all http.proxy
2020-02-23T17:57:33.3440295Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69400/merge:refs/remotes/pull/69400/merge
---
2020-02-23T18:59:09.3294798Z .................................................................................................... 1700/9696
2020-02-23T18:59:13.6954813Z .................................................................................................... 1800/9696
2020-02-23T18:59:24.9216635Z ...........................................i........................................................ 1900/9696
2020-02-23T18:59:32.9256284Z .................................................................................................... 2000/9696
2020-02-23T18:59:46.8286619Z .................................iiiii.............................................................. 2100/9696
2020-02-23T18:59:56.9858657Z .................................................................................................... 2300/9696
2020-02-23T18:59:59.3915449Z .................................................................................................... 2400/9696
2020-02-23T19:00:03.8592214Z .................................................................................................... 2500/9696
2020-02-23T19:00:24.4707001Z .................................................................................................... 2600/9696
---
2020-02-23T19:03:01.5451903Z .........i.......................................................................................... 5000/9696
2020-02-23T19:03:10.3053617Z .................................................................................................... 5100/9696
2020-02-23T19:03:14.7420918Z ....................................i............................................................... 5200/9696
2020-02-23T19:03:24.1972756Z .................................................................................................... 5300/9696
2020-02-23T19:03:29.7759243Z ............ii.ii........i...i...................................................................... 5400/9696
2020-02-23T19:03:37.9692912Z .................................................................................................... 5600/9696
2020-02-23T19:03:48.4520347Z .................................................................................................... 5700/9696
2020-02-23T19:03:55.4726994Z ...i................................................................................................ 5800/9696
2020-02-23T19:04:01.0770869Z .................................................................................................... 5900/9696
2020-02-23T19:04:01.0770869Z .................................................................................................... 5900/9696
2020-02-23T19:04:10.9218149Z ..............................................................................................ii...i 6000/9696
2020-02-23T19:04:22.6794807Z ..ii............i................................................................................... 6100/9696
2020-02-23T19:04:39.0390453Z .................................................................................................... 6300/9696
2020-02-23T19:04:45.3719905Z .................................................................................................... 6400/9696
2020-02-23T19:04:45.3719905Z .................................................................................................... 6400/9696
2020-02-23T19:04:58.1765705Z .........................i..ii...................................................................... 6500/9696
2020-02-23T19:05:18.0278643Z .................................................................................................... 6700/9696
2020-02-23T19:05:20.1694040Z .................i.................................................................................. 6800/9696
2020-02-23T19:05:22.3273406Z .................................................................................................... 6900/9696
2020-02-23T19:05:24.7459125Z .......................................i............................................................ 7000/9696
---
2020-02-23T19:07:02.4215796Z .................................................................................................... 7700/9696
2020-02-23T19:07:07.3171999Z .................................................................................................... 7800/9696
2020-02-23T19:07:13.4866499Z ...................................................................................i................ 7900/9696
2020-02-23T19:07:22.2878295Z .................................................................................................... 8000/9696
2020-02-23T19:07:29.4197604Z ................................iiiiiii.i........................................................... 8100/9696
2020-02-23T19:07:43.4037390Z .................................................................................................... 8300/9696
2020-02-23T19:07:51.6054484Z .................................................................................................... 8400/9696
2020-02-23T19:08:04.9060399Z .................................................................................................... 8500/9696
2020-02-23T19:08:11.5823656Z .................................................................................................... 8600/9696
---
2020-02-23T19:10:35.4696365Z  finished in 7.351
2020-02-23T19:10:35.4882388Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T19:10:35.6902768Z 
2020-02-23T19:10:35.6903111Z running 178 tests
2020-02-23T19:10:38.5570497Z iiii......i...........ii..iiii...i....i...........i............i..i..................i....i......... 100/178
2020-02-23T19:10:40.7838215Z ...i.i.i...iii..iiiiiiiiiiiiiiii.......................iii............ii......
2020-02-23T19:10:40.7844374Z 
2020-02-23T19:10:40.7847586Z  finished in 5.296
2020-02-23T19:10:40.8033045Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T19:10:40.9705173Z 
---
2020-02-23T19:10:42.8595991Z  finished in 2.056
2020-02-23T19:10:42.8759669Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T19:10:43.0218959Z 
2020-02-23T19:10:43.0219274Z running 9 tests
2020-02-23T19:10:43.0220392Z iiiiiiiii
2020-02-23T19:10:43.0222875Z 
2020-02-23T19:10:43.0223174Z  finished in 0.146
2020-02-23T19:10:43.0390876Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T19:10:43.2243041Z 
---
2020-02-23T19:11:02.5060614Z  finished in 19.465
2020-02-23T19:11:02.5273760Z Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T19:11:02.7167928Z 
2020-02-23T19:11:02.7168764Z running 116 tests
2020-02-23T19:11:15.6520138Z iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii..........i.....i..i.......ii.i.ii. 100/116
2020-02-23T19:11:17.5172080Z ....iiii.....ii.
2020-02-23T19:11:17.5174834Z 
2020-02-23T19:11:17.5175037Z  finished in 14.990
2020-02-23T19:11:17.5181378Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-23T19:11:17.5181959Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2020-02-23T19:24:08.0468029Z 
2020-02-23T19:24:08.0469049Z    Doc-tests core
2020-02-23T19:24:12.4202653Z 
2020-02-23T19:24:12.4203147Z running 2476 tests
2020-02-23T19:24:21.0341591Z ......iiiii......................................................................................... 100/2476
2020-02-23T19:24:29.5508656Z ..................................................................................ii................ 200/2476
2020-02-23T19:24:49.2771075Z .................i.................................................................................. 400/2476
2020-02-23T19:24:49.2771075Z .................i.................................................................................. 400/2476
2020-02-23T19:24:58.8794286Z ......................................................................i..i..................iiii.... 500/2476
2020-02-23T19:25:15.5286315Z .................................................................................................... 700/2476
2020-02-23T19:25:23.9297299Z .................................................................................................... 800/2476
2020-02-23T19:25:32.2611098Z .................................................................................................... 900/2476
2020-02-23T19:25:40.9293690Z .................................................................................................... 1000/2476
---
2020-02-23T19:29:11.6958691Z 
2020-02-23T19:29:11.6959062Z running 1009 tests
2020-02-23T19:29:28.8214393Z i................................................................................................... 100/1009
2020-02-23T19:29:38.5873026Z .................................................................................................... 200/1009
2020-02-23T19:29:45.2745641Z ..................iii......i......i...i......i...................................................... 300/1009
2020-02-23T19:29:50.0281074Z .................................................................................................... 400/1009
2020-02-23T19:29:56.4966545Z ............................................i..i.....................................ii............. 500/1009
2020-02-23T19:30:08.4989150Z .................................................................................................... 700/1009
2020-02-23T19:30:08.4989150Z .................................................................................................... 700/1009
2020-02-23T19:30:14.8064111Z ...................................iiii............................................................. 800/1009
2020-02-23T19:30:28.2483287Z .................................................................................................... 900/1009
2020-02-23T19:30:34.8948849Z .........................................................iiii....................................... 1000/1009
2020-02-23T19:30:35.2630608Z test result: ok. 989 passed; 0 failed; 20 ignored; 0 measured; 0 filtered out
2020-02-23T19:30:35.2631293Z 
2020-02-23T19:30:35.2744271Z  finished in 161.305
2020-02-23T19:30:35.2756063Z Testing term stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
2020-02-23T19:48:42.2654029Z Rustbook (x86_64-unknown-linux-gnu) - edition-guide
2020-02-23T19:48:42.6456570Z Building stage0 tool linkchecker (x86_64-unknown-linux-gnu)
2020-02-23T19:48:42.7988218Z    Compiling linkchecker v0.1.0 (/checkout/src/tools/linkchecker)
2020-02-23T19:48:44.2395101Z     Finished release [optimized] target(s) in 1.59s
2020-02-23T19:48:45.5829853Z alloc/collections/vec_deque/struct.VecDeque.html:597: broken link fragment `#method.sort_unstable_by` pointing to `alloc/collections/vec_deque/struct.VecDeque.html`
2020-02-23T19:48:48.0391027Z std/collections/struct.VecDeque.html:597: broken link fragment `#method.sort_unstable_by` pointing to `std/collections/struct.VecDeque.html`
2020-02-23T19:48:48.2580749Z std/collections/vec_deque/struct.VecDeque.html:597: broken link fragment `#method.sort_unstable_by` pointing to `std/collections/vec_deque/struct.VecDeque.html`
2020-02-23T19:48:52.2731884Z thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:43:9
2020-02-23T19:48:52.2767903Z 
2020-02-23T19:48:52.2768297Z 
2020-02-23T19:48:52.2769183Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker" "/checkout/obj/build/x86_64-unknown-linux-gnu/doc"
2020-02-23T19:48:52.2769737Z expected success, got: exit code: 101
---
2020-02-23T19:48:52.2843549Z   local time: Sun Feb 23 19:48:52 UTC 2020
2020-02-23T19:48:53.1771772Z   network time: Sun, 23 Feb 2020 19:48:52 GMT
2020-02-23T19:48:53.1772595Z == end clock drift check ==
2020-02-23T19:48:54.0390579Z 
2020-02-23T19:48:54.0465174Z ##[error]Bash exited with code '1'.
2020-02-23T19:48:54.0479805Z ##[section]Finishing: Run build
2020-02-23T19:48:54.0531439Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69400/merge to s
2020-02-23T19:48:54.0535926Z Task         : Get sources
2020-02-23T19:48:54.0536251Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-23T19:48:54.0536545Z Version      : 1.0.0
2020-02-23T19:48:54.0536742Z Author       : Microsoft
2020-02-23T19:48:54.0536742Z Author       : Microsoft
2020-02-23T19:48:54.0537068Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-23T19:48:54.0537430Z ==============================================================================
2020-02-23T19:48:54.3957064Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-23T19:48:54.3982976Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69400/merge to s
2020-02-23T19:48:54.4084362Z Cleaning up task key
2020-02-23T19:48:54.4085439Z Start cleaning up orphan processes.
2020-02-23T19:48:54.4266934Z Terminate orphan process: pid (4902) (python)
2020-02-23T19:48:54.4506524Z ##[section]Finishing: Finalize Job

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)

@lcnr
Copy link
Contributor Author

lcnr commented Feb 23, 2020

I experimented with first sorting the two slices and then merging them instead of one continuous sort. Not quite sure on how compare the performance of both implementations before this PR is merged, as I can't easily implement the sorting done in this PR outside of liballoc. See https://github.com/lcnr/vecdeque

My current merge is also still broken and needs O(n * log n), as I have to keep an inline sorted buffer.
tbh I am in favor of just using the implementation of this PR for now..

@CryZe
Copy link
Contributor

CryZe commented Feb 24, 2020

This makes me wonder if make_continuous should just be a public API instead that returns a &mut [T], that you can use for not just sorting, but other APIs as well. (With also potentially a get_continuous variant that returns Option<&[T]>)

@lcnr
Copy link
Contributor Author

lcnr commented Mar 8, 2020

superseded by #69425

@lcnr lcnr closed this Mar 8, 2020
@KodrAus
Copy link
Contributor

KodrAus commented Mar 11, 2020

I would personally still be in favour of sorting methods on VecDeque itself, since going through get_contiguous isn't really discoverable for somebody looking for a way to sort.

@lcnr
Copy link
Contributor Author

lcnr commented Mar 11, 2020

By using #[rustc_on_unimplemented] and mentioning it in the overview I think this might be at least partially solved.

I don't think that adding 7 more methods to VecDeque (sort, sort_by, sort_by_key, sort_by_cached_key, sort_unstable, sort_unstable_by, sort_unstable_by_key) is not worth this imo rather small metal complexity. Especially since sorting a VecDeque is used very infrequently.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 31, 2020
add fn make_contiguous to VecDeque

Adds the following method to VecDeque:

```rust
pub fn make_contiguous(&mut self) -> &mut [T];
```

Taken from rust-lang#69400, after a suggestion by @CryZe rust-lang#69400 (comment)

I am in favor of merging this instead of rust-lang#69400.
@lcnr lcnr deleted the deque_sort branch April 6, 2020 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VecDeque has no sort_by method (should possibly have one to match Vec).
4 participants