diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-02-23 14:48:54 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-02-23 23:28:49 +0530 |
| commit | db04229d23119e76f52408b61d960e1bcc52af7a (patch) | |
| tree | 0ea536aed48e5e6f97b607725575309102f60eca /src/libcollections | |
| parent | b2302a50ed534ed671d87835f435af4034705cbe (diff) | |
| parent | 26d9f0ab1aeb3d7b440911104cf17741f83aa0f5 (diff) | |
| download | rust-db04229d23119e76f52408b61d960e1bcc52af7a.tar.gz rust-db04229d23119e76f52408b61d960e1bcc52af7a.zip | |
Rollup merge of #22696 - stepancheg:use-box, r=alexcrichton
e. g. ``` let b: Box<Foo> = Box::from_raw(p); ``` instead of ``` let b: Box<Foo> = mem::transmute(p); ``` Patch also changes closure release code in `src/libstd/sys/unix/thread.rs` when `pthread_create` failed. Raw pointer was transmuted to box of `FnOnce()` instead of `Thunk`. This code was probably never executed, because `pthread_create` rarely fails. (And there are two more patches in PR: fix typo in doc and mark `from_raw` and `into_raw` functions inline.)
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/vec.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 2f9577c08de..0726704056e 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -388,7 +388,7 @@ impl<T> Vec<T> { pub fn into_boxed_slice(mut self) -> Box<[T]> { self.shrink_to_fit(); unsafe { - let xs: Box<[T]> = mem::transmute(&mut *self); + let xs: Box<[T]> = Box::from_raw(&mut *self); mem::forget(self); xs } |
