File tree 2 files changed +7
-13
lines changed
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> {
139
139
/// convert pointer back to `Box` with `Box::from_raw` function, because
140
140
/// `Box` does not specify, how memory is allocated.
141
141
///
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
- ///
146
142
/// # Examples
147
143
/// ```
148
144
/// # #![feature(alloc)]
149
145
/// use std::boxed;
150
146
///
151
147
/// let seventeen = Box::new(17u32);
152
- /// let raw = unsafe { boxed::into_raw(seventeen) } ;
148
+ /// let raw = boxed::into_raw(seventeen);
153
149
/// let boxed_again = unsafe { Box::from_raw(raw) };
154
150
/// ```
155
151
#[ unstable( feature = "alloc" ,
156
152
reason = "may be renamed" ) ]
157
153
#[ 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) }
160
156
}
161
157
162
158
#[ 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> { }
80
80
81
81
impl < T > Node < T > {
82
82
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
+ } )
89
87
}
90
88
}
91
89
You can’t perform that action at this time.
0 commit comments