diff options
| author | Mazdak <twingoow@gmail.com> | 2017-11-08 23:59:35 +0100 |
|---|---|---|
| committer | Mazdak <twingoow@gmail.com> | 2017-11-08 23:59:35 +0100 |
| commit | 2b48b4779ecde356b701a1b12a602443a78d0e6d (patch) | |
| tree | b02d0e3c7eff1cfc5252b608477914e83e7b4d36 | |
| parent | 360ce780fdae0dcb31cfa0f7ffa8a6c9fd62ed32 (diff) | |
| download | rust-2b48b4779ecde356b701a1b12a602443a78d0e6d.tar.gz rust-2b48b4779ecde356b701a1b12a602443a78d0e6d.zip | |
Box::leak - improve documentation
| -rw-r--r-- | src/liballoc/boxed.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index bcf0505ee82..7c3452cc753 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -365,14 +365,15 @@ impl<T: ?Sized> Box<T> { unsafe { mem::transmute(b) } } - /// Consumes and leaks the `Box`, returning a static reference, - /// `&'static T`. + /// Consumes and leaks the `Box`, returning a static mutable reference, + /// `&'static mut T`. /// /// This function is mainly useful for data that lives for the remainder of - /// the programs life. Dropping the returned reference will cause a memory + /// the program's life. Dropping the returned reference will cause a memory /// leak. If this is not acceptable, the reference should first be wrapped - /// with the [`Box::from_raw`] function producing a `Box` which can then be - /// dropped which will properly destroy `T` and release the memory. + /// with the [`Box::from_raw`] function producing a `Box`. This `Box` can + /// then be dropped which will properly destroy `T` and release the + /// allocated memory. /// /// Note: this is an associated function, which means that you have /// to call it as `Box::leak(b)` instead of `b.leak()`. This |
