We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
core::mem::dropped
1 parent 5bc35b1 commit 5733726Copy full SHA for 5733726
src/libcore/mem.rs
@@ -173,12 +173,15 @@ pub unsafe fn zeroed<T>() -> T {
173
#[inline]
174
#[unstable(feature = "filling_drop")]
175
pub unsafe fn dropped<T>() -> T {
176
- let mut x: T = uninitialized();
177
- let p: *mut u8 = transmute(&mut x as *mut T);
178
- for i in 0..size_of::<T>() {
179
- *p.offset(i as isize) = POST_DROP_U8;
180
- }
181
- x
+ #[cfg(stage0)]
+ #[inline(always)]
+ unsafe fn dropped_impl<T>() -> T { zeroed() }
+
+ #[cfg(not(stage0))]
182
+ unsafe fn dropped_impl<T>() -> T { intrinsics::init_dropped() }
183
184
+ dropped_impl()
185
}
186
187
/// Create an uninitialized value.
0 commit comments