about summary refs log tree commit diff
path: root/tests/ui/offset-of/offset-of-output-type.rs
blob: 76a33154ba3d123d98712c73422ad7885f3252cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::mem::offset_of;

struct S {
    v: u8,
    w: u16,
}


fn main() {
    let _: u8 = offset_of!(S, v); //~ ERROR mismatched types
    let _: u16 = offset_of!(S, v); //~ ERROR mismatched types
    let _: u32 = offset_of!(S, v); //~ ERROR mismatched types
    let _: u64 = offset_of!(S, v); //~ ERROR mismatched types
    let _: isize = offset_of!(S, v); //~ ERROR mismatched types
    let _: usize = offset_of!(S, v);

    offset_of!(S, v) //~ ERROR mismatched types
}