Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a73a025

Browse files
authoredJul 29, 2024
Rollup merge of #128284 - GKFX:stabilize-offset-of-nested, r=dtolnay,jieyouxu
Stabilize offset_of_nested Tracking issue #120140. Closes #120140. As the FCP is now nearing its end I have opened a stabilization PR. I have done this separately to the offset_of_enum feature, since that FCP has not started. `@rustbot` label F-offset_of_nested T-lang T-libs-api
2 parents b02cf4c + 23f46e5 commit a73a025

27 files changed

+126
-236
lines changed
 

‎compiler/rustc_error_codes/src/error_codes/E0795.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Invalid argument for the `offset_of!` macro.
33
Erroneous code example:
44

55
```compile_fail,E0795
6-
#![feature(offset_of_enum, offset_of_nested)]
6+
#![feature(offset_of_enum)]
77
88
let x = std::mem::offset_of!(Option<u8>, Some);
99
```
@@ -16,7 +16,7 @@ The offset of the contained `u8` in the `Option<u8>` can be found by specifying
1616
the field name `0`:
1717

1818
```
19-
#![feature(offset_of_enum, offset_of_nested)]
19+
#![feature(offset_of_enum)]
2020
2121
let x: usize = std::mem::offset_of!(Option<u8>, Some.0);
2222
```

‎compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ declare_features! (
292292
(accepted, non_exhaustive, "1.40.0", Some(44109)),
293293
/// Allows `foo.rs` as an alternative to `foo/mod.rs`.
294294
(accepted, non_modrs_mods, "1.30.0", Some(44660)),
295+
/// Allows using multiple nested field accesses in offset_of!
296+
(accepted, offset_of_nested, "CURRENT_RUSTC_VERSION", Some(120140)),
295297
/// Allows the use of or-patterns (e.g., `0 | 1`).
296298
(accepted, or_patterns, "1.53.0", Some(54883)),
297299
/// Allows using `+bundle,+whole-archive` link modifiers with native libs.

‎compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,6 @@ declare_features! (
560560
(unstable, object_safe_for_dispatch, "1.40.0", Some(43561)),
561561
/// Allows using enums in offset_of!
562562
(unstable, offset_of_enum, "1.75.0", Some(120141)),
563-
/// Allows using multiple nested field accesses in offset_of!
564-
(unstable, offset_of_nested, "1.77.0", Some(120140)),
565563
/// Allows using fields with slice type in offset_of!
566564
(unstable, offset_of_slice, "CURRENT_RUSTC_VERSION", Some(126151)),
567565
/// Allows using `#[optimize(X)]`.

‎compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,18 +3338,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
33383338
) -> Ty<'tcx> {
33393339
let container = self.lower_ty(container).normalized;
33403340

3341-
if let Some(ident_2) = fields.get(1)
3342-
&& !self.tcx.features().offset_of_nested
3343-
{
3344-
rustc_session::parse::feature_err(
3345-
&self.tcx.sess,
3346-
sym::offset_of_nested,
3347-
ident_2.span,
3348-
"only a single ident or integer is stable as the field in offset_of",
3349-
)
3350-
.emit();
3351-
}
3352-
33533341
let mut field_indices = Vec::with_capacity(fields.len());
33543342
let mut current_container = container;
33553343
let mut fields = fields.into_iter();

‎library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
//
108108
// Library features:
109109
// tidy-alphabetical-start
110+
#![cfg_attr(bootstrap, feature(offset_of_nested))]
110111
#![feature(array_ptr_get)]
111112
#![feature(asm_experimental_arch)]
112113
#![feature(char_indices_offset)]
@@ -172,7 +173,6 @@
172173
#![feature(isqrt)]
173174
#![feature(link_cfg)]
174175
#![feature(offset_of_enum)]
175-
#![feature(offset_of_nested)]
176176
#![feature(panic_internals)]
177177
#![feature(ptr_alignment_type)]
178178
#![feature(ptr_metadata)]

‎library/core/src/mem/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,8 @@ impl<T> SizedTypeProperties for T {}
13211321
/// # Examples
13221322
///
13231323
/// ```
1324-
/// #![feature(offset_of_enum, offset_of_nested)]
1324+
/// # #![cfg_attr(bootstrap, feature(offset_of_nested))]
1325+
/// #![feature(offset_of_enum)]
13251326
///
13261327
/// use std::mem;
13271328
/// #[repr(C)]

‎library/core/tests/lib.rs

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// tidy-alphabetical-start
2+
#![cfg_attr(bootstrap, feature(offset_of_nested))]
3+
#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
4+
#![cfg_attr(test, feature(cfg_match))]
15
#![feature(alloc_layout_extra)]
26
#![feature(array_chunks)]
37
#![feature(array_ptr_get)]
8+
#![feature(array_try_from_fn)]
49
#![feature(array_windows)]
510
#![feature(ascii_char)]
611
#![feature(ascii_char_variants)]
@@ -9,112 +14,109 @@
914
#![feature(bigint_helper_methods)]
1015
#![feature(cell_update)]
1116
#![feature(clone_to_uninit)]
12-
#![feature(const_align_offset)]
1317
#![feature(const_align_of_val_raw)]
18+
#![feature(const_align_offset)]
19+
#![feature(const_array_from_ref)]
1420
#![feature(const_black_box)]
1521
#![feature(const_cell_into_inner)]
1622
#![feature(const_hash)]
1723
#![feature(const_heap)]
1824
#![feature(const_intrinsic_copy)]
25+
#![feature(const_ip)]
26+
#![feature(const_ipv4)]
27+
#![feature(const_ipv6)]
28+
#![feature(const_likely)]
1929
#![feature(const_maybe_uninit_as_mut_ptr)]
30+
#![feature(const_mut_refs)]
2031
#![feature(const_nonnull_new)]
32+
#![feature(const_option)]
33+
#![feature(const_option_ext)]
34+
#![feature(const_pin)]
2135
#![feature(const_pointer_is_aligned)]
2236
#![feature(const_ptr_as_ref)]
2337
#![feature(const_ptr_write)]
38+
#![feature(const_result)]
39+
#![feature(const_slice_from_ref)]
2440
#![feature(const_three_way_compare)]
2541
#![feature(const_trait_impl)]
26-
#![feature(const_likely)]
2742
#![feature(core_intrinsics)]
2843
#![feature(core_io_borrowed_buf)]
2944
#![feature(core_private_bignum)]
3045
#![feature(core_private_diy_float)]
3146
#![feature(dec2flt)]
32-
#![feature(duration_consts_float)]
3347
#![feature(duration_constants)]
3448
#![feature(duration_constructors)]
49+
#![feature(duration_consts_float)]
50+
#![feature(error_generic_member_access)]
3551
#![feature(exact_size_is_empty)]
3652
#![feature(extern_types)]
37-
#![feature(freeze)]
53+
#![feature(float_minimum_maximum)]
3854
#![feature(flt2dec)]
3955
#![feature(fmt_internals)]
40-
#![feature(float_minimum_maximum)]
56+
#![feature(freeze)]
4157
#![feature(future_join)]
4258
#![feature(generic_assert_internals)]
43-
#![feature(array_try_from_fn)]
59+
#![feature(get_many_mut)]
4460
#![feature(hasher_prefixfree_extras)]
4561
#![feature(hashmap_internals)]
46-
#![feature(try_find)]
47-
#![feature(layout_for_ptr)]
48-
#![feature(pattern)]
49-
#![feature(slice_take)]
50-
#![feature(slice_from_ptr_range)]
51-
#![feature(slice_split_once)]
52-
#![feature(split_as_slice)]
53-
#![feature(maybe_uninit_fill)]
54-
#![feature(maybe_uninit_write_slice)]
55-
#![feature(maybe_uninit_uninit_array_transpose)]
56-
#![feature(min_specialization)]
57-
#![feature(noop_waker)]
58-
#![feature(numfmt)]
59-
#![feature(num_midpoint)]
60-
#![feature(offset_of_nested)]
61-
#![feature(isqrt)]
62-
#![feature(unsigned_is_multiple_of)]
63-
#![feature(step_trait)]
64-
#![feature(str_internals)]
65-
#![feature(std_internals)]
66-
#![feature(test)]
67-
#![feature(trusted_len)]
68-
#![feature(try_blocks)]
69-
#![feature(try_trait_v2)]
70-
#![feature(slice_internals)]
71-
#![feature(slice_partition_dedup)]
62+
#![feature(int_roundings)]
7263
#![feature(ip)]
64+
#![feature(is_ascii_octdigit)]
65+
#![feature(isqrt)]
7366
#![feature(iter_advance_by)]
7467
#![feature(iter_array_chunks)]
7568
#![feature(iter_chain)]
7669
#![feature(iter_collect_into)]
77-
#![feature(iter_partition_in_place)]
7870
#![feature(iter_intersperse)]
7971
#![feature(iter_is_partitioned)]
72+
#![feature(iter_map_windows)]
8073
#![feature(iter_next_chunk)]
8174
#![feature(iter_order_by)]
75+
#![feature(iter_partition_in_place)]
8276
#![feature(iter_repeat_n)]
8377
#![feature(iterator_try_collect)]
8478
#![feature(iterator_try_reduce)]
85-
#![feature(const_ip)]
86-
#![feature(const_ipv4)]
87-
#![feature(const_ipv6)]
88-
#![feature(const_mut_refs)]
89-
#![feature(const_pin)]
79+
#![feature(layout_for_ptr)]
80+
#![feature(maybe_uninit_fill)]
81+
#![feature(maybe_uninit_uninit_array_transpose)]
82+
#![feature(maybe_uninit_write_slice)]
83+
#![feature(min_specialization)]
9084
#![feature(never_type)]
91-
#![feature(unwrap_infallible)]
85+
#![feature(noop_waker)]
86+
#![feature(num_midpoint)]
87+
#![feature(numfmt)]
88+
#![feature(pattern)]
9289
#![feature(pointer_is_aligned_to)]
9390
#![feature(portable_simd)]
9491
#![feature(ptr_metadata)]
95-
#![feature(unsized_tuple_coercion)]
96-
#![feature(const_option)]
97-
#![feature(const_option_ext)]
98-
#![feature(const_result)]
99-
#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
100-
#![cfg_attr(test, feature(cfg_match))]
101-
#![feature(int_roundings)]
92+
#![feature(slice_from_ptr_range)]
93+
#![feature(slice_internals)]
94+
#![feature(slice_partition_dedup)]
95+
#![feature(slice_split_once)]
96+
#![feature(slice_take)]
10297
#![feature(split_array)]
98+
#![feature(split_as_slice)]
99+
#![feature(std_internals)]
100+
#![feature(step_trait)]
101+
#![feature(str_internals)]
103102
#![feature(strict_provenance)]
104103
#![feature(strict_provenance_atomic_ptr)]
104+
#![feature(test)]
105+
#![feature(trait_upcasting)]
106+
#![feature(trusted_len)]
105107
#![feature(trusted_random_access)]
108+
#![feature(try_blocks)]
109+
#![feature(try_find)]
110+
#![feature(try_trait_v2)]
111+
#![feature(unsigned_is_multiple_of)]
106112
#![feature(unsize)]
107-
#![feature(const_array_from_ref)]
108-
#![feature(const_slice_from_ref)]
113+
#![feature(unsized_tuple_coercion)]
114+
#![feature(unwrap_infallible)]
109115
#![feature(waker_getters)]
110-
#![feature(error_generic_member_access)]
111-
#![feature(trait_upcasting)]
112-
#![feature(is_ascii_octdigit)]
113-
#![feature(get_many_mut)]
114-
#![feature(iter_map_windows)]
116+
// tidy-alphabetical-end
115117
#![allow(internal_features)]
116-
#![deny(unsafe_op_in_unsafe_fn)]
117118
#![deny(fuzzy_provenance_casts)]
119+
#![deny(unsafe_op_in_unsafe_fn)]
118120

119121
mod alloc;
120122
mod any;

‎tests/mir-opt/const_prop/offset_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ test-mir-pass: GVN
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44

5-
#![feature(offset_of_enum, offset_of_nested)]
5+
#![feature(offset_of_enum)]
66

77
use std::marker::PhantomData;
88
use std::mem::offset_of;

‎tests/mir-opt/dataflow-const-prop/offset_of.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ test-mir-pass: DataflowConstProp
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33

4-
#![feature(offset_of_nested)]
5-
64
use std::marker::PhantomData;
75
use std::mem::offset_of;
86

‎tests/ui/feature-gates/feature-gate-offset-of-enum.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(offset_of_nested)]
2-
31
use std::mem::offset_of;
42

53
enum Alpha {

‎tests/ui/feature-gates/feature-gate-offset-of-enum.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0573]: expected type, found variant `Alpha::One`
2-
--> $DIR/feature-gate-offset-of-enum.rs:11:16
2+
--> $DIR/feature-gate-offset-of-enum.rs:9:16
33
|
44
LL | offset_of!(Alpha::One, 0);
55
| ^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | offset_of!(Alpha::One, 0);
88
| help: try using the variant's enum: `Alpha`
99

1010
error[E0658]: using enums in offset_of is experimental
11-
--> $DIR/feature-gate-offset-of-enum.rs:12:23
11+
--> $DIR/feature-gate-offset-of-enum.rs:10:23
1212
|
1313
LL | offset_of!(Alpha, One);
1414
| ^^^
@@ -18,13 +18,13 @@ LL | offset_of!(Alpha, One);
1818
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1919

2020
error[E0795]: `One` is an enum variant; expected field at end of `offset_of`
21-
--> $DIR/feature-gate-offset-of-enum.rs:12:23
21+
--> $DIR/feature-gate-offset-of-enum.rs:10:23
2222
|
2323
LL | offset_of!(Alpha, One);
2424
| ^^^ enum variant
2525

2626
error[E0658]: using enums in offset_of is experimental
27-
--> $DIR/feature-gate-offset-of-enum.rs:14:23
27+
--> $DIR/feature-gate-offset-of-enum.rs:12:23
2828
|
2929
LL | offset_of!(Alpha, Two.0);
3030
| ^^^

‎tests/ui/feature-gates/feature-gate-offset-of-nested.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎tests/ui/feature-gates/feature-gate-offset-of-nested.stderr

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎tests/ui/lint/dead-code/offset-of-correct-param-env.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22

3-
#![feature(offset_of_nested)]
43
#![deny(dead_code)]
54

65
// This struct contains a projection that can only be normalized after getting the field type.

‎tests/ui/lint/dead-code/offset-of.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(offset_of_nested)]
21
#![deny(dead_code)]
32

43
use std::mem::offset_of;

‎tests/ui/lint/dead-code/offset-of.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: field `b` is never read
2-
--> $DIR/offset-of.rs:8:5
2+
--> $DIR/offset-of.rs:7:5
33
|
44
LL | struct Alpha {
55
| ----- field in this struct
@@ -8,29 +8,29 @@ LL | b: (),
88
| ^
99
|
1010
note: the lint level is defined here
11-
--> $DIR/offset-of.rs:2:9
11+
--> $DIR/offset-of.rs:1:9
1212
|
1313
LL | #![deny(dead_code)]
1414
| ^^^^^^^^^
1515

1616
error: field `a` is never read
17-
--> $DIR/offset-of.rs:13:5
17+
--> $DIR/offset-of.rs:12:5
1818
|
1919
LL | struct Beta {
2020
| ---- field in this struct
2121
LL | a: (),
2222
| ^
2323

2424
error: field `a` is never read
25-
--> $DIR/offset-of.rs:18:5
25+
--> $DIR/offset-of.rs:17:5
2626
|
2727
LL | struct Gamma {
2828
| ----- field in this struct
2929
LL | a: (),
3030
| ^
3131

3232
error: field `b` is never read
33-
--> $DIR/offset-of.rs:24:5
33+
--> $DIR/offset-of.rs:23:5
3434
|
3535
LL | struct Delta {
3636
| ----- field in this struct
@@ -39,7 +39,7 @@ LL | b: (),
3939
| ^
4040

4141
error: field `a` is never read
42-
--> $DIR/offset-of.rs:35:5
42+
--> $DIR/offset-of.rs:34:5
4343
|
4444
LL | struct Project<T: Trait> {
4545
| ------- field in this struct

‎tests/ui/offset-of/offset-of-enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(offset_of_enum, offset_of_nested)]
1+
#![feature(offset_of_enum)]
22

33
use std::mem::offset_of;
44

‎tests/ui/offset-of/offset-of-private.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(offset_of_enum, offset_of_nested)]
1+
#![feature(offset_of_enum)]
22

33
use std::mem::offset_of;
44

‎tests/ui/offset-of/offset-of-self.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(offset_of_nested)]
2-
31
use std::mem::offset_of;
42

53
struct C<T> {

‎tests/ui/offset-of/offset-of-self.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: offset_of expects dot-separated field and variant names
2-
--> $DIR/offset-of-self.rs:20:26
2+
--> $DIR/offset-of-self.rs:18:26
33
|
44
LL | offset_of!(Self, Self::v);
55
| ^^^^^^^
66

77
error[E0412]: cannot find type `S` in module `self`
8-
--> $DIR/offset-of-self.rs:34:26
8+
--> $DIR/offset-of-self.rs:32:26
99
|
1010
LL | offset_of!(self::S, v);
1111
| ^ not found in `self`
@@ -21,7 +21,7 @@ LL + offset_of!(S, v);
2121
|
2222

2323
error[E0411]: cannot find type `Self` in this scope
24-
--> $DIR/offset-of-self.rs:51:16
24+
--> $DIR/offset-of-self.rs:49:16
2525
|
2626
LL | fn main() {
2727
| ---- `Self` not allowed in a function
@@ -30,29 +30,29 @@ LL | offset_of!(Self, v);
3030
| ^^^^ `Self` is only available in impls, traits, and type definitions
3131

3232
error[E0609]: no field `Self` on type `S`
33-
--> $DIR/offset-of-self.rs:21:23
33+
--> $DIR/offset-of-self.rs:19:23
3434
|
3535
LL | offset_of!(S, Self);
3636
| ^^^^
3737
|
3838
= note: available fields are: `v`, `w`
3939

4040
error[E0616]: field `v` of struct `T` is private
41-
--> $DIR/offset-of-self.rs:40:30
41+
--> $DIR/offset-of-self.rs:38:30
4242
|
4343
LL | offset_of!(Self, v)
4444
| ^ private field
4545

4646
error[E0609]: no field `self` on type `S`
47-
--> $DIR/offset-of-self.rs:53:19
47+
--> $DIR/offset-of-self.rs:51:19
4848
|
4949
LL | offset_of!(S, self);
5050
| ^^^^
5151
|
5252
= note: available fields are: `v`, `w`
5353

5454
error[E0609]: no field `self` on type `u8`
55-
--> $DIR/offset-of-self.rs:54:21
55+
--> $DIR/offset-of-self.rs:52:21
5656
|
5757
LL | offset_of!(S, v.self);
5858
| ^^^^

‎tests/ui/offset-of/offset-of-slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-pass
2-
#![feature(offset_of_slice, offset_of_nested)]
2+
#![feature(offset_of_slice)]
33

44
use std::mem::offset_of;
55

‎tests/ui/offset-of/offset-of-tuple-nested.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Test for issue #112204 -- make sure this goes through the entire compilation pipeline,
33
// similar to why `offset-of-unsized.rs` is also build-pass
44

5-
#![feature(offset_of_nested)]
6-
75
use std::mem::offset_of;
86

97
type ComplexTup = ((u8, (u8, (u8, u16), u8)), (u8, u32, u16));

‎tests/ui/offset-of/offset-of-tuple.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(offset_of_nested)]
21
#![feature(builtin_syntax)]
32

43
use std::mem::offset_of;

‎tests/ui/offset-of/offset-of-tuple.stderr

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: suffixes on a tuple index are invalid
2-
--> $DIR/offset-of-tuple.rs:19:35
2+
--> $DIR/offset-of-tuple.rs:18:35
33
|
44
LL | builtin # offset_of((u8, u8), 1_u8);
55
| ^^^^ invalid suffix `u8`
66

77
error: leading `+` is not supported
8-
--> $DIR/offset-of-tuple.rs:23:37
8+
--> $DIR/offset-of-tuple.rs:22:37
99
|
1010
LL | { builtin # offset_of((u8, u8), +1) };
1111
| ^ unexpected `+`
@@ -17,67 +17,67 @@ LL + { builtin # offset_of((u8, u8), 1) };
1717
|
1818

1919
error: offset_of expects dot-separated field and variant names
20-
--> $DIR/offset-of-tuple.rs:24:38
20+
--> $DIR/offset-of-tuple.rs:23:38
2121
|
2222
LL | { builtin # offset_of((u8, u8), 1.) };
2323
| ^
2424

2525
error: unexpected token: `)`
26-
--> $DIR/offset-of-tuple.rs:25:40
26+
--> $DIR/offset-of-tuple.rs:24:40
2727
|
2828
LL | { builtin # offset_of((u8, u8), 1 .) };
2929
| ^
3030

3131
error: unexpected token: `)`
32-
--> $DIR/offset-of-tuple.rs:47:45
32+
--> $DIR/offset-of-tuple.rs:46:45
3333
|
3434
LL | { builtin # offset_of(ComplexTup, 0.0.1.) };
3535
| ^
3636

3737
error: unexpected token: `)`
38-
--> $DIR/offset-of-tuple.rs:48:46
38+
--> $DIR/offset-of-tuple.rs:47:46
3939
|
4040
LL | { builtin # offset_of(ComplexTup, 0 .0.1.) };
4141
| ^
4242

4343
error: unexpected token: `)`
44-
--> $DIR/offset-of-tuple.rs:49:47
44+
--> $DIR/offset-of-tuple.rs:48:47
4545
|
4646
LL | { builtin # offset_of(ComplexTup, 0 . 0.1.) };
4747
| ^
4848

4949
error: unexpected token: `)`
50-
--> $DIR/offset-of-tuple.rs:50:46
50+
--> $DIR/offset-of-tuple.rs:49:46
5151
|
5252
LL | { builtin # offset_of(ComplexTup, 0. 0.1.) };
5353
| ^
5454

5555
error: unexpected token: `)`
56-
--> $DIR/offset-of-tuple.rs:51:46
56+
--> $DIR/offset-of-tuple.rs:50:46
5757
|
5858
LL | { builtin # offset_of(ComplexTup, 0.0 .1.) };
5959
| ^
6060

6161
error: unexpected token: `)`
62-
--> $DIR/offset-of-tuple.rs:52:47
62+
--> $DIR/offset-of-tuple.rs:51:47
6363
|
6464
LL | { builtin # offset_of(ComplexTup, 0.0 . 1.) };
6565
| ^
6666

6767
error: unexpected token: `)`
68-
--> $DIR/offset-of-tuple.rs:53:46
68+
--> $DIR/offset-of-tuple.rs:52:46
6969
|
7070
LL | { builtin # offset_of(ComplexTup, 0.0. 1.) };
7171
| ^
7272

7373
error: suffixes on a tuple index are invalid
74-
--> $DIR/offset-of-tuple.rs:10:26
74+
--> $DIR/offset-of-tuple.rs:9:26
7575
|
7676
LL | offset_of!((u8, u8), 1_u8);
7777
| ^^^^ invalid suffix `u8`
7878

7979
error: no rules expected the token `+`
80-
--> $DIR/offset-of-tuple.rs:12:26
80+
--> $DIR/offset-of-tuple.rs:11:26
8181
|
8282
LL | offset_of!((u8, u8), +1);
8383
| ^ no rules expected this token in macro call
@@ -86,115 +86,115 @@ note: while trying to match meta-variable `$fields:expr`
8686
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
8787

8888
error: offset_of expects dot-separated field and variant names
89-
--> $DIR/offset-of-tuple.rs:13:26
89+
--> $DIR/offset-of-tuple.rs:12:26
9090
|
9191
LL | offset_of!((u8, u8), -1);
9292
| ^^
9393

9494
error: offset_of expects dot-separated field and variant names
95-
--> $DIR/offset-of-tuple.rs:14:27
95+
--> $DIR/offset-of-tuple.rs:13:27
9696
|
9797
LL | offset_of!((u8, u8), 1.);
9898
| ^
9999

100100
error: unexpected token: `)`
101-
--> $DIR/offset-of-tuple.rs:15:29
101+
--> $DIR/offset-of-tuple.rs:14:29
102102
|
103103
LL | offset_of!((u8, u8), 1 .);
104104
| ^
105105

106106
error: unexpected token: `)`
107-
--> $DIR/offset-of-tuple.rs:36:34
107+
--> $DIR/offset-of-tuple.rs:35:34
108108
|
109109
LL | offset_of!(ComplexTup, 0.0.1.);
110110
| ^
111111

112112
error: unexpected token: `)`
113-
--> $DIR/offset-of-tuple.rs:37:35
113+
--> $DIR/offset-of-tuple.rs:36:35
114114
|
115115
LL | offset_of!(ComplexTup, 0 .0.1.);
116116
| ^
117117

118118
error: unexpected token: `)`
119-
--> $DIR/offset-of-tuple.rs:38:36
119+
--> $DIR/offset-of-tuple.rs:37:36
120120
|
121121
LL | offset_of!(ComplexTup, 0 . 0.1.);
122122
| ^
123123

124124
error: unexpected token: `)`
125-
--> $DIR/offset-of-tuple.rs:39:35
125+
--> $DIR/offset-of-tuple.rs:38:35
126126
|
127127
LL | offset_of!(ComplexTup, 0. 0.1.);
128128
| ^
129129

130130
error: unexpected token: `)`
131-
--> $DIR/offset-of-tuple.rs:40:35
131+
--> $DIR/offset-of-tuple.rs:39:35
132132
|
133133
LL | offset_of!(ComplexTup, 0.0 .1.);
134134
| ^
135135

136136
error: unexpected token: `)`
137-
--> $DIR/offset-of-tuple.rs:41:36
137+
--> $DIR/offset-of-tuple.rs:40:36
138138
|
139139
LL | offset_of!(ComplexTup, 0.0 . 1.);
140140
| ^
141141

142142
error: unexpected token: `)`
143-
--> $DIR/offset-of-tuple.rs:42:35
143+
--> $DIR/offset-of-tuple.rs:41:35
144144
|
145145
LL | offset_of!(ComplexTup, 0.0. 1.);
146146
| ^
147147

148148
error[E0609]: no field `_0` on type `(u8, u8)`
149-
--> $DIR/offset-of-tuple.rs:7:26
149+
--> $DIR/offset-of-tuple.rs:6:26
150150
|
151151
LL | offset_of!((u8, u8), _0);
152152
| ^^
153153

154154
error[E0609]: no field `01` on type `(u8, u8)`
155-
--> $DIR/offset-of-tuple.rs:8:26
155+
--> $DIR/offset-of-tuple.rs:7:26
156156
|
157157
LL | offset_of!((u8, u8), 01);
158158
| ^^
159159

160160
error[E0609]: no field `1e2` on type `(u8, u8)`
161-
--> $DIR/offset-of-tuple.rs:9:26
161+
--> $DIR/offset-of-tuple.rs:8:26
162162
|
163163
LL | offset_of!((u8, u8), 1e2);
164164
| ^^^
165165

166166
error[E0609]: no field `1_` on type `(u8, u8)`
167-
--> $DIR/offset-of-tuple.rs:10:26
167+
--> $DIR/offset-of-tuple.rs:9:26
168168
|
169169
LL | offset_of!((u8, u8), 1_u8);
170170
| ^^^^
171171

172172
error[E0609]: no field `1e2` on type `(u8, u8)`
173-
--> $DIR/offset-of-tuple.rs:16:35
173+
--> $DIR/offset-of-tuple.rs:15:35
174174
|
175175
LL | builtin # offset_of((u8, u8), 1e2);
176176
| ^^^
177177

178178
error[E0609]: no field `_0` on type `(u8, u8)`
179-
--> $DIR/offset-of-tuple.rs:17:35
179+
--> $DIR/offset-of-tuple.rs:16:35
180180
|
181181
LL | builtin # offset_of((u8, u8), _0);
182182
| ^^
183183

184184
error[E0609]: no field `01` on type `(u8, u8)`
185-
--> $DIR/offset-of-tuple.rs:18:35
185+
--> $DIR/offset-of-tuple.rs:17:35
186186
|
187187
LL | builtin # offset_of((u8, u8), 01);
188188
| ^^
189189

190190
error[E0609]: no field `1_` on type `(u8, u8)`
191-
--> $DIR/offset-of-tuple.rs:19:35
191+
--> $DIR/offset-of-tuple.rs:18:35
192192
|
193193
LL | builtin # offset_of((u8, u8), 1_u8);
194194
| ^^^^
195195

196196
error[E0609]: no field `2` on type `(u8, u16)`
197-
--> $DIR/offset-of-tuple.rs:31:47
197+
--> $DIR/offset-of-tuple.rs:30:47
198198
|
199199
LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2);
200200
| _____------------------------------------------^-
@@ -207,7 +207,7 @@ LL | | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0);
207207
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
208208

209209
error[E0609]: no field `0` on type `u8`
210-
--> $DIR/offset-of-tuple.rs:33:49
210+
--> $DIR/offset-of-tuple.rs:32:49
211211
|
212212
LL | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0);
213213
| ^

‎tests/ui/offset-of/offset-of-unstable-with-feature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ check-pass
22
//@ aux-build:offset-of-staged-api.rs
33

4-
#![feature(offset_of_nested, unstable_test_feature)]
4+
#![feature(unstable_test_feature)]
55

66
use std::mem::offset_of;
77

‎tests/ui/offset-of/offset-of-unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ aux-build:offset-of-staged-api.rs
22

3-
#![feature(offset_of_nested)]
4-
53
use std::mem::offset_of;
64

75
extern crate offset_of_staged_api;

‎tests/ui/offset-of/offset-of-unstable.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: use of unstable library feature 'unstable_test_feature'
2-
--> $DIR/offset-of-unstable.rs:14:9
2+
--> $DIR/offset-of-unstable.rs:12:9
33
|
44
LL | Unstable,
55
| ^^^^^^^^
@@ -8,7 +8,7 @@ LL | Unstable,
88
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
99

1010
error[E0658]: use of unstable library feature 'unstable_test_feature'
11-
--> $DIR/offset-of-unstable.rs:23:9
11+
--> $DIR/offset-of-unstable.rs:21:9
1212
|
1313
LL | UnstableWithStableFieldType,
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL | UnstableWithStableFieldType,
1717
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1818

1919
error[E0658]: use of unstable library feature 'unstable_test_feature'
20-
--> $DIR/offset-of-unstable.rs:28:9
20+
--> $DIR/offset-of-unstable.rs:26:9
2121
|
2222
LL | UnstableWithStableFieldType,
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | UnstableWithStableFieldType,
2626
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2727

2828
error[E0658]: use of unstable library feature 'unstable_test_feature'
29-
--> $DIR/offset-of-unstable.rs:12:5
29+
--> $DIR/offset-of-unstable.rs:10:5
3030
|
3131
LL | / offset_of!(
3232
LL | |
@@ -40,7 +40,7 @@ LL | | );
4040
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
4141

4242
error[E0658]: use of unstable library feature 'unstable_test_feature'
43-
--> $DIR/offset-of-unstable.rs:18:5
43+
--> $DIR/offset-of-unstable.rs:16:5
4444
|
4545
LL | offset_of!(StableWithUnstableField, unstable);
4646
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +50,7 @@ LL | offset_of!(StableWithUnstableField, unstable);
5050
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
5151

5252
error[E0658]: use of unstable library feature 'unstable_test_feature'
53-
--> $DIR/offset-of-unstable.rs:20:5
53+
--> $DIR/offset-of-unstable.rs:18:5
5454
|
5555
LL | offset_of!(StableWithUnstableFieldType, stable.unstable);
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +60,7 @@ LL | offset_of!(StableWithUnstableFieldType, stable.unstable);
6060
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
6161

6262
error[E0658]: use of unstable library feature 'unstable_test_feature'
63-
--> $DIR/offset-of-unstable.rs:21:5
63+
--> $DIR/offset-of-unstable.rs:19:5
6464
|
6565
LL | / offset_of!(
6666
LL | |
@@ -74,7 +74,7 @@ LL | | );
7474
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
7575

7676
error[E0658]: use of unstable library feature 'unstable_test_feature'
77-
--> $DIR/offset-of-unstable.rs:26:5
77+
--> $DIR/offset-of-unstable.rs:24:5
7878
|
7979
LL | / offset_of!(
8080
LL | |

0 commit comments

Comments
 (0)
Please sign in to comment.