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 fn make_contiguous to VecDeque #69425

Merged
merged 5 commits into from Mar 31, 2020
Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Feb 24, 2020

Adds the following method to VecDeque:

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

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

I am in favor of merging this instead of #69400.

@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 24, 2020
@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-24T10:36:22.0031098Z ========================== Starting Command Output ===========================
2020-02-24T10:36:22.0034857Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/1b69a1df-8bda-4853-877a-248348e4b26b.sh
2020-02-24T10:36:22.0035279Z 
2020-02-24T10:36:22.0054629Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-24T10:36:22.0074824Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-02-24T10:36:22.0078069Z Task         : Get sources
2020-02-24T10:36:22.0078422Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-24T10:36:22.0078702Z Version      : 1.0.0
2020-02-24T10:36:22.0078890Z Author       : Microsoft
---
2020-02-24T10:36:24.3070726Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-24T10:36:24.3244760Z ##[command]git config gc.auto 0
2020-02-24T10:36:24.3277864Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-24T10:36:24.3313729Z ##[command]git config --get-all http.proxy
2020-02-24T10:36:24.3410541Z ##[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/69425/merge:refs/remotes/pull/69425/merge
---
2020-02-24T11:39:28.3007480Z .................................................................................................... 1700/9704
2020-02-24T11:39:32.7494930Z .................................................................................................... 1800/9704
2020-02-24T11:39:44.3539123Z ...........................................i........................................................ 1900/9704
2020-02-24T11:39:52.0988182Z .................................................................................................... 2000/9704
2020-02-24T11:40:06.1262742Z .................................iiiii.............................................................. 2100/9704
2020-02-24T11:40:15.6033807Z .................................................................................................... 2300/9704
2020-02-24T11:40:17.8734606Z .................................................................................................... 2400/9704
2020-02-24T11:40:22.1067462Z .................................................................................................... 2500/9704
2020-02-24T11:40:42.5256765Z .................................................................................................... 2600/9704
---
2020-02-24T11:43:21.6621841Z .........i.......................................................................................... 5000/9704
2020-02-24T11:43:30.6572245Z .................................................................................................... 5100/9704
2020-02-24T11:43:35.1658993Z ....................................i............................................................... 5200/9704
2020-02-24T11:43:44.7420265Z .................................................................................................... 5300/9704
2020-02-24T11:43:50.4599693Z ............ii.ii........i...i...................................................................... 5400/9704
2020-02-24T11:43:58.7473045Z .................................................................................................... 5600/9704
2020-02-24T11:44:09.2377373Z .................................................................................................... 5700/9704
2020-02-24T11:44:16.3013402Z ...i................................................................................................ 5800/9704
2020-02-24T11:44:21.8451432Z .................................................................................................... 5900/9704
2020-02-24T11:44:21.8451432Z .................................................................................................... 5900/9704
2020-02-24T11:44:31.6902331Z ..............................................................................................ii...i 6000/9704
2020-02-24T11:44:43.1858829Z ..ii...........i.................................................................................... 6100/9704
2020-02-24T11:44:59.2893669Z .................................................................................................... 6300/9704
2020-02-24T11:45:05.6454529Z .................................................................................................... 6400/9704
2020-02-24T11:45:18.3120413Z ..........................i.ii...................................................................... 6500/9704
2020-02-24T11:45:25.3962857Z .................................................................................................... 6600/9704
---
2020-02-24T11:47:22.6456981Z .................................................................................................... 7700/9704
2020-02-24T11:47:27.4906791Z .................................................................................................... 7800/9704
2020-02-24T11:47:33.9914972Z ...........................................................................................i........ 7900/9704
2020-02-24T11:47:42.4435417Z .................................................................................................... 8000/9704
2020-02-24T11:47:50.0339474Z ........................................iiiiiii.i................................................... 8100/9704
2020-02-24T11:48:04.5136542Z .................................................................................................... 8300/9704
2020-02-24T11:48:10.6447786Z .................................................................................................... 8400/9704
2020-02-24T11:48:25.2330372Z .................................................................................................... 8500/9704
2020-02-24T11:48:32.1229419Z .................................................................................................... 8600/9704
---
2020-02-24T11:50:49.7766788Z  finished in 7.026
2020-02-24T11:50:49.7950338Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T11:50:49.9855698Z 
2020-02-24T11:50:49.9856042Z running 178 tests
2020-02-24T11:50:52.6612464Z iiii......i...........ii..iiii...i....i...........i............i..i..................i....i......... 100/178
2020-02-24T11:50:54.8184476Z ...i.i.i...iii..iiiiiiiiiiiiiiii.......................iii............ii......
2020-02-24T11:50:54.8188252Z 
2020-02-24T11:50:54.8195964Z  finished in 5.024
2020-02-24T11:50:54.8358742Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T11:50:54.9828959Z 
---
2020-02-24T11:50:56.7923193Z  finished in 1.956
2020-02-24T11:50:56.8098696Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T11:50:56.9645541Z 
2020-02-24T11:50:56.9645849Z running 9 tests
2020-02-24T11:50:56.9646880Z iiiiiiiii
2020-02-24T11:50:56.9647759Z 
2020-02-24T11:50:56.9648155Z  finished in 0.154
2020-02-24T11:50:56.9829886Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T11:50:57.1682531Z 
---
2020-02-24T11:51:15.7021529Z  finished in 18.719
2020-02-24T11:51:15.7220250Z Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T11:51:15.8898593Z 
2020-02-24T11:51:15.8899084Z running 116 tests
2020-02-24T11:51:28.3243718Z 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-24T11:51:30.0859550Z ....iiii.....ii.
2020-02-24T11:51:30.0860981Z 
2020-02-24T11:51:30.0864447Z  finished in 14.364
2020-02-24T11:51:30.0864998Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T11:51:30.0865601Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2020-02-24T12:03:33.1966545Z   local time: Mon Feb 24 12:03:33 UTC 2020
2020-02-24T12:03:33.3646431Z   network time: Mon, 24 Feb 2020 12:03:33 GMT
2020-02-24T12:03:33.3652499Z == end clock drift check ==
2020-02-24T12:03:33.9854802Z 
2020-02-24T12:03:33.9931641Z ##[error]Bash exited with code '1'.
2020-02-24T12:03:33.9947435Z ##[section]Finishing: Run build
2020-02-24T12:03:34.0012419Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-02-24T12:03:34.0018195Z Task         : Get sources
2020-02-24T12:03:34.0018532Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-24T12:03:34.0018853Z Version      : 1.0.0
2020-02-24T12:03:34.0019088Z Author       : Microsoft
2020-02-24T12:03:34.0019088Z Author       : Microsoft
2020-02-24T12:03:34.0019434Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-24T12:03:34.0019844Z ==============================================================================
2020-02-24T12:03:34.3998821Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-24T12:03:34.4091897Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-02-24T12:03:34.4188323Z Cleaning up task key
2020-02-24T12:03:34.4189645Z Start cleaning up orphan processes.
2020-02-24T12:03:34.4377719Z Terminate orphan process: pid (4279) (python)
2020-02-24T12:03:34.4622535Z ##[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 lcnr force-pushed the make_contiguous branch 2 times, most recently from 62b7f1c to 63ff9a9 Compare February 24, 2020 17:19
@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-24T17:20:34.4906927Z ========================== Starting Command Output ===========================
2020-02-24T17:20:34.4910713Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/e3765cdb-9720-4e52-bbff-b53eba98eef0.sh
2020-02-24T17:20:34.4911168Z 
2020-02-24T17:20:34.4915409Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-24T17:20:34.4936999Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-02-24T17:20:34.4940283Z Task         : Get sources
2020-02-24T17:20:34.4940571Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-24T17:20:34.4940849Z Version      : 1.0.0
2020-02-24T17:20:34.4941095Z Author       : Microsoft
---
2020-02-24T17:20:35.4805613Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-24T17:20:35.4811525Z ##[command]git config gc.auto 0
2020-02-24T17:20:35.4816658Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-24T17:20:35.4820175Z ##[command]git config --get-all http.proxy
2020-02-24T17:20:35.4826285Z ##[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/69425/merge:refs/remotes/pull/69425/merge
---
2020-02-24T18:29:26.2082760Z .................................................................................................... 1700/9704
2020-02-24T18:29:31.0719007Z .................................................................................................... 1800/9704
2020-02-24T18:29:43.2071097Z ...........................................i........................................................ 1900/9704
2020-02-24T18:29:51.6414313Z .................................................................................................... 2000/9704
2020-02-24T18:30:06.9544054Z .................................iiiii.............................................................. 2100/9704
2020-02-24T18:30:17.4491405Z .................................................................................................... 2300/9704
2020-02-24T18:30:20.1223937Z .................................................................................................... 2400/9704
2020-02-24T18:30:24.9093868Z .................................................................................................... 2500/9704
2020-02-24T18:30:47.4380793Z .................................................................................................... 2600/9704
---
2020-02-24T18:33:40.3825396Z .........i.......................................................................................... 5000/9704
2020-02-24T18:33:50.2126379Z .................................................................................................... 5100/9704
2020-02-24T18:33:55.2881668Z ....................................i............................................................... 5200/9704
2020-02-24T18:34:06.0184411Z .................................................................................................... 5300/9704
2020-02-24T18:34:12.4038345Z ............ii.ii........i...i...................................................................... 5400/9704
2020-02-24T18:34:21.6552438Z .................................................................................................... 5600/9704
2020-02-24T18:34:33.2729491Z .................................................................................................... 5700/9704
2020-02-24T18:34:40.8104314Z ...i................................................................................................ 5800/9704
2020-02-24T18:34:46.8811509Z .................................................................................................... 5900/9704
2020-02-24T18:34:46.8811509Z .................................................................................................... 5900/9704
2020-02-24T18:34:58.0936703Z ..............................................................................................ii...i 6000/9704
2020-02-24T18:35:11.1765119Z ..ii...........i.................................................................................... 6100/9704
2020-02-24T18:35:29.7051958Z .................................................................................................... 6300/9704
2020-02-24T18:35:37.0715515Z .................................................................................................... 6400/9704
2020-02-24T18:35:37.0715515Z .................................................................................................... 6400/9704
2020-02-24T18:36:02.2560739Z .........................i..ii..............................................test [ui] ui/mpsc_stress.rs has been running for over 60 seconds
2020-02-24T18:36:12.2549983Z .................................................................................................... 6600/9704
2020-02-24T18:36:26.2691363Z .................................................................................................... 6700/9704
2020-02-24T18:36:28.7615074Z .................i.................................................................................. 6800/9704
2020-02-24T18:36:31.0799974Z .................................................................................................... 6900/9704
---
2020-02-24T18:38:23.8029389Z .................................................................................................... 7700/9704
2020-02-24T18:38:29.3735755Z .................................................................................................... 7800/9704
2020-02-24T18:38:36.8353399Z ...........................................................................................i........ 7900/9704
2020-02-24T18:38:46.1401095Z .................................................................................................... 8000/9704
2020-02-24T18:38:54.1926592Z ........................................iiiiiii.i................................................... 8100/9704
2020-02-24T18:39:10.9073094Z .................................................................................................... 8300/9704
2020-02-24T18:39:18.2417827Z .................................................................................................... 8400/9704
2020-02-24T18:39:35.3073341Z .................................................................................................... 8500/9704
2020-02-24T18:39:43.1795549Z .................................................................................................... 8600/9704
---
2020-02-24T18:42:20.9344305Z  finished in 8.180
2020-02-24T18:42:20.9556692Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T18:42:21.1794100Z 
2020-02-24T18:42:21.1794458Z running 178 tests
2020-02-24T18:42:24.4033232Z iiii......i...........ii..iiii...i....i...........i............i..i..................i....i......... 100/178
2020-02-24T18:42:26.9585983Z ...i.i.i...iii..iiiiiiiiiiiiiiii.......................iii............ii......
2020-02-24T18:42:26.9592262Z 
2020-02-24T18:42:26.9597445Z  finished in 6.004
2020-02-24T18:42:26.9802879Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T18:42:27.1540903Z 
---
2020-02-24T18:42:29.2729524Z  finished in 2.292
2020-02-24T18:42:29.2943421Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T18:42:29.4645509Z 
2020-02-24T18:42:29.4646261Z running 9 tests
2020-02-24T18:42:29.4648374Z iiiiiiiii
2020-02-24T18:42:29.4650082Z 
2020-02-24T18:42:29.4650532Z  finished in 0.170
2020-02-24T18:42:29.4872572Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T18:42:29.6813000Z 
---
2020-02-24T18:42:51.5706280Z  finished in 22.085
2020-02-24T18:42:51.6008301Z Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T18:42:52.4796051Z 
2020-02-24T18:42:52.4796471Z running 116 tests
2020-02-24T18:43:06.8050450Z 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-24T18:43:08.8544583Z ....iiii.....ii.
2020-02-24T18:43:08.8546727Z 
2020-02-24T18:43:08.8553297Z  finished in 17.253
2020-02-24T18:43:08.8560596Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-02-24T18:43:08.8561560Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2020-02-24T18:56:21.2954342Z ---- collections/vec_deque.rs - collections::vec_deque::VecDeque<T>::get_contiguous (line 2031) stdout ----
2020-02-24T18:56:21.2954833Z error[E0308]: mismatched types
2020-02-24T18:56:21.2955357Z   --> collections/vec_deque.rs:2045:1
2020-02-24T18:56:21.2956987Z    |
2020-02-24T18:56:21.2957231Z 17 | assert_eq!(buf.get_contiguous(), Some(&[3, 2, 1]));
2020-02-24T18:56:21.2957665Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[{integer}]`, found array `[{integer}; 3]`
2020-02-24T18:56:21.2958020Z    |
2020-02-24T18:56:21.2958285Z    = note: expected enum `std::option::Option<&[{integer}]>`
2020-02-24T18:56:21.2960530Z               found enum `std::option::Option<&[{integer}; 3]>`
2020-02-24T18:56:21.2963009Z 
2020-02-24T18:56:21.2963203Z error: aborting due to previous error
2020-02-24T18:56:21.2963404Z 
2020-02-24T18:56:21.2964101Z For more information about this error, try `rustc --explain E0308`.
2020-02-24T18:56:21.2964101Z For more information about this error, try `rustc --explain E0308`.
2020-02-24T18:56:21.2965650Z Couldn't compile the test.
2020-02-24T18:56:21.2966329Z ---- collections/vec_deque.rs - collections::vec_deque::VecDeque<T>::get_contiguous_mut (line 2063) stdout ----
2020-02-24T18:56:21.2966884Z error[E0308]: mismatched types
2020-02-24T18:56:21.2967351Z   --> collections/vec_deque.rs:2079:1
2020-02-24T18:56:21.2967870Z    |
2020-02-24T18:56:21.2968229Z 19 | assert_eq!(buf.get_contiguous(), Some(&[3, 2, 42]));
2020-02-24T18:56:21.2968686Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[{integer}]`, found array `[{integer}; 3]`
2020-02-24T18:56:21.2969037Z    |
2020-02-24T18:56:21.2969477Z    = note: expected enum `std::option::Option<&[{integer}]>`
2020-02-24T18:56:21.2970976Z               found enum `std::option::Option<&[{integer}; 3]>`
2020-02-24T18:56:21.2972295Z 
2020-02-24T18:56:21.2972485Z error: aborting due to previous error
2020-02-24T18:56:21.2972659Z 
2020-02-24T18:56:21.2973165Z For more information about this error, try `rustc --explain E0308`.
2020-02-24T18:56:21.2973165Z For more information about this error, try `rustc --explain E0308`.
2020-02-24T18:56:21.2973931Z Couldn't compile the test.
2020-02-24T18:56:21.2974619Z ---- collections/vec_deque.rs - collections::vec_deque::VecDeque<T>::make_contiguous (line 2100) stdout ----
2020-02-24T18:56:21.2975049Z error[E0308]: mismatched types
2020-02-24T18:56:21.2975474Z   --> collections/vec_deque.rs:2113:1
2020-02-24T18:56:21.2975679Z    |
2020-02-24T18:56:21.2976216Z 16 | assert_eq!(buf.get_contiguous(), Some(&[1, 2, 3]));
2020-02-24T18:56:21.2976702Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[{integer}]`, found array `[{integer}; 3]`
2020-02-24T18:56:21.2977038Z    |
2020-02-24T18:56:21.2977298Z    = note: expected enum `std::option::Option<&[{integer}]>`
2020-02-24T18:56:21.2977704Z               found enum `std::option::Option<&[{integer}; 3]>`
2020-02-24T18:56:21.2978772Z 
2020-02-24T18:56:21.2978981Z error: aborting due to previous error
2020-02-24T18:56:21.2979153Z 
2020-02-24T18:56:21.2979591Z For more information about this error, try `rustc --explain E0308`.
---
2020-02-24T18:56:21.3245290Z   local time: Mon Feb 24 18:56:21 UTC 2020
2020-02-24T18:56:21.8661993Z   network time: Mon, 24 Feb 2020 18:56:21 GMT
2020-02-24T18:56:21.8662283Z == end clock drift check ==
2020-02-24T18:56:22.4490207Z 
2020-02-24T18:56:22.4583312Z ##[error]Bash exited with code '1'.
2020-02-24T18:56:22.4599562Z ##[section]Finishing: Run build
2020-02-24T18:56:22.4652710Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-02-24T18:56:22.4657972Z Task         : Get sources
2020-02-24T18:56:22.4658339Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-24T18:56:22.4658704Z Version      : 1.0.0
2020-02-24T18:56:22.4658950Z Author       : Microsoft
2020-02-24T18:56:22.4658950Z Author       : Microsoft
2020-02-24T18:56:22.4659342Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-24T18:56:22.4659803Z ==============================================================================
2020-02-24T18:56:22.8289032Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-24T18:56:22.8338273Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-02-24T18:56:22.8442261Z Cleaning up task key
2020-02-24T18:56:22.8443542Z Start cleaning up orphan processes.
2020-02-24T18:56:22.8627632Z Terminate orphan process: pid (3871) (python)
2020-02-24T18:56:22.8810527Z ##[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)

Copy link
Contributor

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @lcnr!

The extra ASCII diagrams of our start and end states are helpful! I think it would also be good to add some prose to the comments in each branch of the algorithm too, like the old code had when the centre has room for either the head or tail.

src/liballoc/collections/vec_deque.rs Outdated Show resolved Hide resolved
src/liballoc/collections/vec_deque.rs Outdated Show resolved Hide resolved
@lcnr
Copy link
Contributor Author

lcnr commented Mar 11, 2020

Added a short comment explaining whats going on, is there anything else I should mention?

@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-03-11T13:54:26.2287895Z ========================== Starting Command Output ===========================
2020-03-11T13:54:26.2290699Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/2f13d116-6e69-4187-916c-b26d2d4b64ff.sh
2020-03-11T13:54:26.2290992Z 
2020-03-11T13:54:26.2295454Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-11T13:54:26.2315705Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-03-11T13:54:26.2319459Z Task         : Get sources
2020-03-11T13:54:26.2319803Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-11T13:54:26.2320113Z Version      : 1.0.0
2020-03-11T13:54:26.2320532Z Author       : Microsoft
---
2020-03-11T13:54:27.2228346Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-11T13:54:27.2236827Z ##[command]git config gc.auto 0
2020-03-11T13:54:27.2244480Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-11T13:54:27.2251158Z ##[command]git config --get-all http.proxy
2020-03-11T13:54:27.2260653Z ##[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/69425/merge:refs/remotes/pull/69425/merge
---
2020-03-11T14:00:10.4866497Z Found 0 error codes with no tests
2020-03-11T14:00:10.4867053Z Done!
2020-03-11T14:00:10.4867494Z 
2020-03-11T14:00:10.4867850Z 
2020-03-11T14:00:10.4869680Z 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"
2020-03-11T14:00:10.4877108Z 
2020-03-11T14:00:10.4877627Z 
2020-03-11T14:00:10.4878098Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2020-03-11T14:00:10.4878682Z Build completed unsuccessfully in 0:01:32
2020-03-11T14:00:10.4878682Z Build completed unsuccessfully in 0:01:32
2020-03-11T14:00:10.4931218Z == clock drift check ==
2020-03-11T14:00:10.4939291Z   local time: Wed Mar 11 14:00:10 UTC 2020
2020-03-11T14:00:10.7842470Z   network time: Wed, 11 Mar 2020 14:00:10 GMT
2020-03-11T14:00:10.7843278Z == end clock drift check ==
2020-03-11T14:00:11.5953454Z 
2020-03-11T14:00:11.6030800Z ##[error]Bash exited with code '1'.
2020-03-11T14:00:11.6056706Z ##[section]Finishing: Run build
2020-03-11T14:00:11.6114144Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-03-11T14:00:11.6119332Z Task         : Get sources
2020-03-11T14:00:11.6119740Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-11T14:00:11.6120100Z Version      : 1.0.0
2020-03-11T14:00:11.6120542Z Author       : Microsoft
2020-03-11T14:00:11.6120542Z Author       : Microsoft
2020-03-11T14:00:11.6120958Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-11T14:00:11.6121421Z ==============================================================================
2020-03-11T14:00:11.9727852Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-11T14:00:11.9772684Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69425/merge to s
2020-03-11T14:00:11.9874353Z Cleaning up task key
2020-03-11T14:00:11.9875846Z Start cleaning up orphan processes.
2020-03-11T14:00:12.0203612Z Terminate orphan process: pid (3848) (python)
2020-03-11T14:00:12.0237529Z ##[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 @rust-lang/infra. (Feature Requests)

@lcnr
Copy link
Contributor Author

lcnr commented Mar 11, 2020

seems like the file length ended up being less than 3000 after some unrelated changes

@Dylan-DPC-zz
Copy link

r? @Amanieu

@rust-highfive rust-highfive assigned Amanieu and unassigned KodrAus Mar 21, 2020
@Mark-Simulacrum
Copy link
Member

I think it's true that our only use case right now is essentially make_contiguous().sort(), right? (For one of the sort functions, of which there are many).

And I think the discoverability point that @KodrAus mentions is an important one, I would suggest at least having all of the (current) sort functions on slices called out by name in the documentation for make_contiguous so that if someone is on the VecDeque docs page and searches for it they land on that function.

One thought is that we could even implement DerefMut for VecDeque to slice but that seems too likely to cause accidental problems; ideally I think we would be able to show in rustdoc somehow that "all of these methods are available but you need to call this one to get them".

I think we should also mention make_contiguous in the top-level comment describing VecDeque... and maybe also call out the into/from Vec conversions being zero-cost after the initial "make_contiguous" call.

@lcnr
Copy link
Contributor Author

lcnr commented Mar 21, 2020

@Mark-Simulacrum pedantic: conversions to Vec are not actually zero cost after make_contiguous rn, as
make_contiguous may end up like this:

....ABCDEF....

which still needs to be shifted to the start of the buffer, which has a runtime of O(n), to be converted into a Vec.

Will update the PR tomorrow. I don't feel 100 % comfortable recommending this method in the struct docs while it is unstable though.

@Mark-Simulacrum
Copy link
Member

Ah, yes, that's a good point -- let's avoid the top-level mention (but leave a note in the tracking issue) but do call out sort/sort_by/etc in the function-level documentation.

Interesting, I guess my brief look missed that make_contiguous is slightly more efficient than the Vec conversion. Nice!

@lcnr
Copy link
Contributor Author

lcnr commented Mar 22, 2020

Sorting is now explicitly mentioned in the documentation, and sort and sort_by are also used in the example. Imo this should be enough while this is still unstable.

btw, can we use something like #[rustc_on_unimplemented] here?

@Amanieu
Copy link
Member

Amanieu commented Mar 22, 2020

Can you update the documentation for as_slices to say that after calling make_contiguous all the elements will be in the first slice and the second slice will be empty.

@lcnr
Copy link
Contributor Author

lcnr commented Mar 22, 2020

Done, not completely satisfied with the wording though.

src/liballoc/collections/vec_deque.rs Outdated Show resolved Hide resolved
src/liballoc/collections/vec_deque.rs Outdated Show resolved Hide resolved
src/liballoc/collections/vec_deque.rs Outdated Show resolved Hide resolved
Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
@joelpalmer joelpalmer added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 30, 2020
@Amanieu
Copy link
Member

Amanieu commented Mar 31, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Mar 31, 2020

📌 Commit e1afd26 has been approved by Amanieu

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 31, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 31, 2020
Rollup of 7 pull requests

Successful merges:

 - rust-lang#69425 (add fn make_contiguous to VecDeque)
 - rust-lang#69458 (improve folder name for persistent doc tests)
 - rust-lang#70268 (Document ThreadSanitizer in unstable-book)
 - rust-lang#70600 (Ensure there are versions of test code for aarch64 windows)
 - rust-lang#70606 (Clean up E0466 explanation)
 - rust-lang#70614 (remove unnecessary relocation check in const_prop)
 - rust-lang#70623 (Fix broken link in README)

Failed merges:

r? @ghost
@bors bors merged commit f62cfa7 into rust-lang:master Mar 31, 2020
@lcnr lcnr deleted the make_contiguous branch July 6, 2020 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants