rust/tests/ui/offset-of/offset-of-dst-field.rs

34 lines
482 B
Rust
Raw Normal View History

2023-04-21 03:53:34 -05:00
#![feature(offset_of, extern_types)]
2022-09-11 02:37:49 -05:00
use std::mem::offset_of;
2023-04-21 03:53:34 -05:00
struct Alpha {
2022-09-11 02:37:49 -05:00
x: u8,
y: u16,
2023-04-21 03:53:34 -05:00
z: [u8],
}
trait Trait {}
struct Beta {
x: u8,
y: u16,
z: dyn Trait,
}
extern {
type Extern;
}
struct Gamma {
x: u8,
y: u16,
z: Extern,
2022-09-11 02:37:49 -05:00
}
fn main() {
2023-04-21 03:53:34 -05:00
offset_of!(Alpha, z); //~ ERROR the size for values of type
offset_of!(Beta, z); //~ ERROR the size for values of type
offset_of!(Gamma, z); //~ ERROR the size for values of type
2022-09-11 02:37:49 -05:00
}