rust/tests/ui/offset-of/offset-of-private.rs
2023-04-21 02:14:02 -07:00

17 lines
280 B
Rust

#![feature(offset_of)]
use std::mem::offset_of;
mod m {
#[repr(C)]
pub struct Foo {
pub public: u8,
private: u8,
}
}
fn main() {
offset_of!(m::Foo, public);
offset_of!(m::Foo, private); //~ ERROR field `private` of struct `Foo` is private
}