-
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
fix: do not borrow shell across registry query #13647
Conversation
Talked with @Muscraft and agree that it's safer to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! gctx.shell()
is tricky, and I have shot myself in the foot with it many times (most recently when working on the linting system). I think removing bindings from it everywhere is a good idea.
Do you think it would be a good idea to add a test for this?
I lean toward not. Such a test cannot systematically prevent this kind of runtime borrow checking bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to r=
me when CI passes if I don't get to it first
@bors r+ I tested this change locally against https://github.com/taiki-e/easytime and it fixes the panic |
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request. |
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)
…rkingjubilee Update cargo 5 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) - Do not strip debuginfo by default for MSVC (rust-lang/cargo#13630) - chore(deps): update msrv (rust-lang/cargo#13577) - Fix doc collision for lib/bin with a dash in the inferred name. (rust-lang/cargo#13640) - refactor: Make lint names snake_case (rust-lang/cargo#13635) r? ghost
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>
What does this PR try to resolve?
Fixes #13646
How should we test and review this PR?
Additional information
A better and safer way is always calling
gctx.shell()
instead.