-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #45881 - Centril:box-leak, r=alexcrichton
Add Box::leak<'a>(Box<T>) -> &'a mut T where T: 'a Adds: ```rust impl<T: ?Sized> Box<T> { pub fn leak<'a>(b: Box<T>) -> &'a mut T where T: 'a { unsafe { &mut *Box::into_raw(b) } } } ``` which is useful for when you just want to put some stuff on the heap and then have a reference to it for the remainder of the program. r? @sfackler cc @durka
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters