-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rollup of 8 pull requests #69463
Rollup of 8 pull requests #69463
Conversation
Usually, references to the interior are only created by the `Deref` and `DerefMut` impl of the guards `Ref` and `RefMut`. Note that `RefCell` already has to cope with leaks of such guards which, when it occurs, effectively makes it impossible to ever acquire a mutable guard or any guard for `Ref` and `RefMut` respectively. It is already safe to use this to create a reference to the inner of the ref cell that lives as long as the reference to the `RefCell` itself, e.g. ```rust fn leak(r: &RefCell<usize>) -> Option<&usize> { let guard = r.try_borrow().ok()?; let leaked = Box::leak(Box::new(guard)); Some(&*leaked) } ``` The newly added methods allow the same reference conversion without an indirection over a leaked allocation and composing with both borrow and try_borrow without additional method combinations.
This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from.
…olnay Add primitive module to libcore This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from. Fixes rust-lang#44865
…tolnay Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference Usually, references to the interior are only created by the `Deref` and `DerefMut` impl of the guards `Ref` and `RefMut`. Note that `RefCell` already has to cope with leaks of such guards which, when it occurs, effectively makes it impossible to ever acquire a mutable guard or any guard for `Ref` and `RefMut` respectively. It is already safe to use this to create a reference to the inner of the ref cell that lives as long as the reference to the `RefCell` itself, e.g. ```rust fn leak(r: &RefCell<usize>) -> Option<&usize> { let guard = r.try_borrow().ok()?; let leaked = Box::leak(Box::new(guard)); Some(&*leaked) } ``` The newly added methods allow the same reference conversion without an indirection over a leaked allocation. It's placed on the `Ref`/`RefMut` to compose with both borrow and try_borrow directly.
…acrum debug_assert a few more raw pointer methods Fixes rust-lang#53871
…crum Deduplicate identifier printing a bit rust-lang#67010 introduced a couple more subtly different ways to print an identifier. This PR attempts to restore the order. The most basic identifier printing interface is `Formatter`-based now, so `String`s are not allocated unless required. r? @Mark-Simulacrum
syntax: Remove `Nt(Impl,Trait,Foreign)Item` Follow-up to rust-lang#69366. r? @Centril
remove redundant clones and import
…bank Minor refactoring of statement parsing Extracted out of rust-lang#69445. r? @estebank
…, r=Dylan-DPC Clean up e0370 e0371 r? @Dylan-DPC
@bors r+ rollup=never p=8 |
📌 Commit 6e392e2 has been approved by |
⌛ Testing commit 6e392e2 with merge f81b3bb9764dc39151666f137db4666aeee6f452... |
💔 Test failed - checks-azure |
The job Click to expand the log.
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 |
Successful merges:
Nt(Impl,Trait,Foreign)Item
#69423 (syntax: RemoveNt(Impl,Trait,Foreign)Item
)Failed merges:
r? @ghost