about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-23 19:18:15 +0000
committerbors <bors@rust-lang.org>2017-11-23 19:18:15 +0000
commit246a6d19c9844744737876fc55701395ae535579 (patch)
tree9ef5b0465b144f07a2cbbb4af01214025d387641 /src/libstd/sys/unix/stack_overflow.rs
parent0916bbc00027626e4ae6027ee08a8dd46036e8b2 (diff)
parentbc18d99232b4d049e24d64ae228f0ee0c01fcebd (diff)
downloadrust-246a6d19c9844744737876fc55701395ae535579.tar.gz
rust-246a6d19c9844744737876fc55701395ae535579.zip
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
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions