Skip to content

Commit 601eca3

Browse files
committed
Added instability markers to POST_DROP_* consts, and related opt-in's.
(Reviewed rest of code; did not see other `pub` items that needed such treatment.) Driveby: fix typo in comment in ptr.rs.
1 parent 5733726 commit 601eca3

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#![feature(box_syntax)]
7676
#![feature(optin_builtin_traits)]
7777
#![feature(unboxed_closures)]
78-
#![feature(unsafe_no_drop_flag)]
78+
#![feature(unsafe_no_drop_flag, filling_drop)]
7979
#![feature(core)]
8080
#![feature(unique)]
8181
#![cfg_attr(test, feature(test, alloc, rustc_private))]

src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#![feature(unicode)]
3737
#![feature(unsafe_destructor)]
3838
#![feature(unique)]
39-
#![feature(unsafe_no_drop_flag)]
39+
#![feature(unsafe_no_drop_flag, filling_drop)]
4040
#![feature(step_by)]
4141
#![feature(str_char)]
4242
#![feature(convert)]

src/libcore/mem.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,28 @@ macro_rules! repeat_u8_as_u64 {
337337
// But having the sign bit set is a pain, so 0x1d is probably better.
338338
//
339339
// And of course, 0x00 brings back the old world of zero'ing on drop.
340-
#[cfg(not(stage0))] pub const POST_DROP_U8: u8 = 0x1d;
341-
#[cfg(not(stage0))] pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8);
342-
#[cfg(not(stage0))] pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8);
340+
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
341+
pub const POST_DROP_U8: u8 = 0x1d;
342+
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
343+
pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8);
344+
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
345+
pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8);
343346

344347
#[cfg(target_pointer_width = "32")]
345-
#[cfg(not(stage0))] pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize;
348+
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
349+
pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize;
346350
#[cfg(target_pointer_width = "64")]
347-
#[cfg(not(stage0))] pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
351+
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
352+
pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
348353

349-
#[cfg(stage0)] pub const POST_DROP_U8: u8 = 0;
350-
#[cfg(stage0)] pub const POST_DROP_U32: u32 = 0;
351-
#[cfg(stage0)] pub const POST_DROP_U64: u64 = 0;
352-
#[cfg(stage0)] pub const POST_DROP_USIZE: usize = 0;
354+
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
355+
pub const POST_DROP_U8: u8 = 0;
356+
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
357+
pub const POST_DROP_U32: u32 = 0;
358+
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
359+
pub const POST_DROP_U64: u64 = 0;
360+
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
361+
pub const POST_DROP_USIZE: usize = 0;
353362

354363
/// Interprets `src` as `&U`, and then reads `src` without moving the contained value.
355364
///

src/libcore/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
231231
}
232232

233233
/// Variant of read_and_zero that writes the specific drop-flag byte
234-
/// (which may be more apropriate than zero).
234+
/// (which may be more appropriate than zero).
235235
#[inline(always)]
236236
#[unstable(feature = "core",
237237
reason = "may play a larger role in std::ptr future extensions")]

src/libstd/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
#![feature(unboxed_closures)]
122122
#![feature(unicode)]
123123
#![feature(unsafe_destructor)]
124-
#![feature(unsafe_no_drop_flag)]
124+
#![feature(unsafe_no_drop_flag, filling_drop)]
125125
#![feature(macro_reexport)]
126126
#![feature(int_uint)]
127127
#![feature(unique)]

0 commit comments

Comments
 (0)