File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -139,24 +139,20 @@ impl<T : ?Sized> Box<T> {
139139/// convert pointer back to `Box` with `Box::from_raw` function, because
140140/// `Box` does not specify, how memory is allocated.
141141///
142- /// Function is unsafe, because result of this function is no longer
143- /// automatically managed that may lead to memory or other resource
144- /// leak.
145- ///
146142/// # Examples
147143/// ```
148144/// # #![feature(alloc)]
149145/// use std::boxed;
150146///
151147/// let seventeen = Box::new(17u32);
152- /// let raw = unsafe { boxed::into_raw(seventeen) } ;
148+ /// let raw = boxed::into_raw(seventeen);
153149/// let boxed_again = unsafe { Box::from_raw(raw) };
154150/// ```
155151#[ unstable( feature = "alloc" ,
156152 reason = "may be renamed" ) ]
157153#[ inline]
158- pub unsafe fn into_raw < T : ?Sized > ( b : Box < T > ) -> * mut T {
159- mem:: transmute ( b)
154+ pub fn into_raw < T : ?Sized > ( b : Box < T > ) -> * mut T {
155+ unsafe { mem:: transmute ( b) }
160156}
161157
162158#[ stable( feature = "rust1" , since = "1.0.0" ) ]
Original file line number Diff line number Diff line change @@ -80,12 +80,10 @@ unsafe impl<T: Send> Sync for Queue<T> { }
8080
8181impl < T > Node < T > {
8282 fn new ( ) -> * mut Node < T > {
83- unsafe {
84- boxed:: into_raw ( box Node {
85- value : None ,
86- next : AtomicPtr :: new ( ptr:: null_mut :: < Node < T > > ( ) ) ,
87- } )
88- }
83+ boxed:: into_raw ( box Node {
84+ value : None ,
85+ next : AtomicPtr :: new ( ptr:: null_mut :: < Node < T > > ( ) ) ,
86+ } )
8987 }
9088}
9189
You can’t perform that action at this time.
0 commit comments