diff options
author | Mazdak <twingoow@gmail.com> | 2017-11-09 23:39:18 +0100 |
---|---|---|
committer | Mazdak <twingoow@gmail.com> | 2017-11-09 23:39:18 +0100 |
commit | 46800ab135f70d8869e58e4163730ba2b38006ba (patch) | |
tree | 9a900c677a1b150c6cd280abcfa0f7a0b94c7829 | |
parent | ee24e992b640d09d31d34938dbe7131db9cb18a9 (diff) | |
download | rust-46800ab135f70d8869e58e4163730ba2b38006ba.tar.gz |
Box::leak - made an oops, fixed now =)
-rw-r--r-- | src/liballoc/boxed.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 49f5f68fa77..c76f51057ff 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -411,7 +411,10 @@ impl<T: ?Sized> Box<T> { #[unstable(feature = "box_leak", reason = "needs an FCP to stabilize", issue = "0")] #[inline] - pub fn leak<'a, T: 'a>(b: Box<T>) -> &'a mut T { + pub fn leak<'a>(b: Box<T>) -> &'a mut T + where + T: 'a // Technically not needed, but kept to be explicit. + { unsafe { &mut *Box::into_raw(b) } } } |