Auto merge of #117537 - GKFX:offset-of-enum-feature, r=cjgillot
Feature gate enums in offset_of As requested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790815262, put enums in offset_of behind their own feature gate. `@rustbot` label F-offset_of
This commit is contained in:
commit
992943dbae
10 changed files with 70 additions and 5 deletions
|
@ -3,7 +3,7 @@ Invalid argument for the `offset_of!` macro.
|
|||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0795
|
||||
#![feature(offset_of)]
|
||||
#![feature(offset_of, offset_of_enum)]
|
||||
|
||||
let x = std::mem::offset_of!(Option<u8>, Some);
|
||||
```
|
||||
|
@ -16,7 +16,7 @@ The offset of the contained `u8` in the `Option<u8>` can be found by specifying
|
|||
the field name `0`:
|
||||
|
||||
```
|
||||
#![feature(offset_of)]
|
||||
#![feature(offset_of, offset_of_enum)]
|
||||
|
||||
let x: usize = std::mem::offset_of!(Option<u8>, Some.0);
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue