diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/offset-of/offset-of-private.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/ui/offset-of/offset-of-private.rs b/tests/ui/offset-of/offset-of-private.rs index 6b1a16ba6..b7affdb79 100644 --- a/tests/ui/offset-of/offset-of-private.rs +++ b/tests/ui/offset-of/offset-of-private.rs @@ -1,4 +1,4 @@ -#![feature(offset_of)] +#![feature(offset_of, offset_of_enum)] use std::mem::offset_of; @@ -8,13 +8,20 @@ mod m { pub public: u8, private: u8, } + #[repr(C)] pub struct FooTuple(pub u8, u8); + #[repr(C)] struct Bar { pub public: u8, private: u8, } + + pub enum Baz { + Var1(Foo), + Var2(u64), + } } fn main() { @@ -25,4 +32,8 @@ fn main() { offset_of!(m::Bar, public); //~ ERROR struct `Bar` is private offset_of!(m::Bar, private); //~ ERROR struct `Bar` is private //~| ERROR field `private` of struct `Bar` is private + + offset_of!(m::Baz, Var1.0.public); + offset_of!(m::Baz, Var1.0.private); //~ ERROR field `private` of struct `Foo` is private + offset_of!(m::Baz, Var2.0); } |