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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
280 B
Rust
Raw Normal View History

2022-09-11 02:37:49 -05:00
#![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
}