-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Panic with "already borrowed: BorrowMutError" since nightly-2024-03-26 #13646
Comments
I also observed this in https://github.com/dtolnay/rustversion/actions/runs/8429673336/job/23084341781, in which I use neither |
From a quick look at the panic location (GlobalContext::shell), backtrace, and #13561 diff, it appears to be related to the fact that BorrowMut (returned by GlobalContext::shell), which previously persisted only during printing, now persists for the entire print_lockfile_updates. |
Update cargo 1 commits in a510712d05c6c98f987af24dd73cdfafee8922e6..499a61ce7a0fc6a72040084862a68b2603e770e8 2024-03-25 03:45:54 +0000 to 2024-03-26 04:17:04 +0000 - fix: do not borrow shell across registry query (rust-lang/cargo#13647) r? ghost <hr> This update includes a fix for a panic within cargo that was noted in [cargo#13646](rust-lang/cargo#13646)
So it appears the reason manual testing and the test suite didn't hit this is there wasn't contention over the package lock. In fact, we only have one test that even attempts to capture the Blocking status. We could try to make a specific test case to prevent regressions in this one case but then we'd likely run into this in other places. As an alternative, we could do a useless borrow of |
I wonder How it looks like and how it applies to other RefCell usages in the codebase. |
This intentionally borrows from `RefCell`s before conditional code to try to prevent regressions like rust-lang#13646 without exhaustively covering every case that could hit these `BorrowMutError`s with complicated tests. I tested this by ensuring the registry code path panicked before rebasing on top of rust-lang#13647. Once I rebased, the panic went away.
This intentionally borrows from `RefCell`s before conditional code to try to prevent regressions like rust-lang#13646 without exhaustively covering every case that could hit these `BorrowMutError`s with complicated tests. I tested this by ensuring the registry code path panicked before rebasing on top of rust-lang#13647. Once I rebased, the panic went away. Co-authored-by: Ed Page <eopage@gmail.com>
test: Add asserts to catch BorrowMutError's ### What does this PR try to resolve? This intentionally borrows from `RefCell`s before conditional code to try to prevent regressions like #13646 without exhaustively covering every case that could hit these `BorrowMutError`s with complicated tests. ### How should we test and review this PR? I tested this by ensuring the registry code path panicked before rebasing on top of #13647. Once I rebased, the panic went away. ### Additional information Split off from #13649 to try to avoid appveyor
This intentionally borrows from `RefCell`s before conditional code to try to prevent regressions like rust-lang#13646 without exhaustively covering every case that could hit these `BorrowMutError`s with complicated tests. I tested this by ensuring the registry code path panicked before rebasing on top of rust-lang#13647. Once I rebased, the panic went away. Co-authored-by: Ed Page <eopage@gmail.com>
Problem
Since nightly-2024-03-26, -Z minimal-versions and -Z direct-minimal-versions panic on some my projects when lockfile is already exists.
EDIT: this seems to be reproducible without -Z minimal-versions/-Z direct-minimal-versions: #13646 (comment)
Steps
It can be work around by removing Cargo.lock before calling
-Z minimal-versions
.It can also be reproduced with https://github.com/taiki-e/pin-project-lite.
It can also be reproduced with -Z direct-minimal-versions.
Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: