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 remove_current_as_list to LinkedList's CursorMut #71878

Merged
merged 2 commits into from
May 5, 2020

Conversation

main--
Copy link
Contributor

@main-- main-- commented May 4, 2020

The remove_current method only returns the inner T and deallocates the list node. This is unnecessary for move operations, where the element is going to be linked back into this (or even a different) LinkedList. The remove_current_as_list method avoids this by returning the unlinked list node as a new single-element LinkedList structure.

(per #58533 (comment))

The `remove_current` method only returns the inner `T` and deallocates the list node. This is unnecessary for move operations, where the element is going to be linked back into this (or even a different) `LinkedList`. The `remove_current_as_list` method avoids this by returning the unlinked list node as a new single-element `LinkedList` structure .
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @hanna-kruppe (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 rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2020
@rust-highfive
Copy link
Collaborator

The job mingw-check 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.
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/0d465b97-228d-48cb-a38b-d5ec698e215f.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/71878/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[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/71878/merge:refs/remotes/pull/71878/merge
---
 ---> f7353ccad5b1
Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
 ---> Using cache
 ---> ed38efbaa060
Step 7/7 : ENV SCRIPT python3 ../x.py test src/tools/expand-yaml-anchors &&            python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python3 ../x.py build --stage 0 src/tools/build-manifest &&            python3 ../x.py test --stage 0 src/tools/compiletest &&            python3 ../x.py test src/tools/tidy &&            /scripts/validate-toolstate.sh
 ---> c5008ef7ae8e
Successfully built c5008ef7ae8e
Successfully tagged rust-ci:latest
Built container sha256:c5008ef7ae8e94d7ef502e3cef26e61208e14ebdb36913f3a8bb86291bd6430b
---
    Checking alloc v0.0.0 (/checkout/src/liballoc)
    Checking rustc-demangle v0.1.16
    Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
    Checking backtrace v0.3.46
error[E0596]: cannot borrow `unlinked_node` as mutable, as it is not declared as mutable
     |
     |
1508 |         let unlinked_node = self.current?;
     |             ------------- help: consider changing this to be mutable: `mut unlinked_node`
...
1513 |             unlinked_node.as_mut().prev = None;


error[E0596]: cannot borrow `unlinked_node` as mutable, as it is not declared as mutable
     |
     |
1508 |         let unlinked_node = self.current?;
     |             ------------- help: consider changing this to be mutable: `mut unlinked_node`
1514 |             unlinked_node.as_mut().next = None;
     |             ^^^^^^^^^^^^^ cannot borrow as mutable

error: aborting due to 2 previous errors
---
  local time: Mon May  4 14:00:47 UTC 2020
  network time: Mon, 04 May 2020 14:00:47 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/71878/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/71878/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (5621) (python)
##[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)

@hanna-kruppe
Copy link
Contributor

r? @Amanieu

@rust-highfive rust-highfive assigned Amanieu and unassigned hanna-kruppe May 4, 2020
@Amanieu
Copy link
Member

Amanieu commented May 4, 2020

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 4, 2020

📌 Commit c5cdf7f 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-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#71587 (Report cannot move errors in promoted MIR)
 - rust-lang#71711 (Updates to some ignored tests)
 - rust-lang#71845 (Add const examples)
 - rust-lang#71878 (Add remove_current_as_list to LinkedList's CursorMut)
 - rust-lang#71881 (Correctly handle UEFI targets as Windows-like when emitting sections for LLVM bitcode)
 - rust-lang#71883 (add a missing "at" in a comment)
 - rust-lang#71891 (¬∃x. ¬y => ∀x. y)
 - rust-lang#71892 (Update btree_map::VacantEntry::insert docs to actually call insert)
 - rust-lang#71902 (Suggest to add missing feature when using gated const features)
 - rust-lang#71904 (fix typo in function name)

Failed merges:

r? @ghost
@bors bors merged commit faccb0f into rust-lang:master May 5, 2020
@main-- main-- deleted the patch-2 branch May 5, 2020 07:54
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.

5 participants