Skip to content

Commit 458c762

Browse files
committed
Stabilize simple offset_of
1 parent 5d58c1b commit 458c762

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
//
112112
// Library features:
113113
// tidy-alphabetical-start
114+
#![cfg_attr(not(bootstrap), feature(offset_of_nested))]
114115
#![feature(char_indices_offset)]
115116
#![feature(const_align_of_val)]
116117
#![feature(const_align_of_val_raw)]
@@ -176,7 +177,6 @@
176177
#![feature(isqrt)]
177178
#![feature(maybe_uninit_uninit_array)]
178179
#![feature(non_null_convenience)]
179-
#![feature(offset_of)]
180180
#![feature(offset_of_enum)]
181181
#![feature(panic_internals)]
182182
#![feature(ptr_alignment_type)]

core/src/mem/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,11 +1303,12 @@ impl<T> SizedTypeProperties for T {}
13031303
/// Enum variants may be traversed as if they were fields. Variants themselves do
13041304
/// not have an offset.
13051305
///
1306+
/// However, on stable only a single field name is supported, which blocks the use of
1307+
/// enum support.
1308+
///
13061309
/// Visibility is respected - all types and fields must be visible to the call site:
13071310
///
13081311
/// ```
1309-
/// #![feature(offset_of)]
1310-
///
13111312
/// mod nested {
13121313
/// #[repr(C)]
13131314
/// pub struct Struct {
@@ -1330,8 +1331,6 @@ impl<T> SizedTypeProperties for T {}
13301331
/// not *identical*, e.g.:
13311332
///
13321333
/// ```
1333-
/// #![feature(offset_of)]
1334-
///
13351334
/// struct Wrapper<T, U>(T, U);
13361335
///
13371336
/// type A = Wrapper<u8, u8>;
@@ -1359,8 +1358,7 @@ impl<T> SizedTypeProperties for T {}
13591358
/// # Examples
13601359
///
13611360
/// ```
1362-
/// #![feature(offset_of)]
1363-
/// # #![feature(offset_of_enum)]
1361+
/// #![feature(offset_of_enum, offset_of_nested)]
13641362
///
13651363
/// use std::mem;
13661364
/// #[repr(C)]
@@ -1396,15 +1394,15 @@ impl<T> SizedTypeProperties for T {}
13961394
/// assert_eq!(mem::offset_of!(Option<&u8>, Some.0), 0);
13971395
/// ```
13981396
#[cfg(not(bootstrap))]
1399-
#[unstable(feature = "offset_of", issue = "106655")]
1397+
#[stable(feature = "offset_of", since = "CURRENT_RUSTC_VERSION")]
14001398
#[allow_internal_unstable(builtin_syntax, hint_must_use)]
14011399
pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) {
14021400
// The `{}` is for better error messages
14031401
crate::hint::must_use({builtin # offset_of($Container, $($fields)+)})
14041402
}
14051403

14061404
#[cfg(bootstrap)]
1407-
#[unstable(feature = "offset_of", issue = "106655")]
1405+
#[stable(feature = "offset_of", since = "CURRENT_RUSTC_VERSION")]
14081406
#[allow_internal_unstable(builtin_syntax, hint_must_use)]
14091407
#[allow(missing_docs)]
14101408
pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {

core/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
#![feature(utf8_chunks)]
116116
#![feature(is_ascii_octdigit)]
117117
#![feature(get_many_mut)]
118-
#![feature(offset_of)]
119118
#![feature(iter_map_windows)]
120119
#![allow(internal_features)]
121120
#![deny(unsafe_op_in_unsafe_fn)]

std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@
329329
#![feature(maybe_uninit_slice)]
330330
#![feature(maybe_uninit_uninit_array)]
331331
#![feature(maybe_uninit_write_slice)]
332-
#![feature(offset_of)]
333332
#![feature(panic_can_unwind)]
334333
#![feature(panic_info_message)]
335334
#![feature(panic_internals)]

0 commit comments

Comments
 (0)