about summary refs log tree commit diff
path: root/tests/ui/offset-of/offset-of-temporaries.rs
blob: 951a8ee2b50399aaa1d309763f223462d5e3d517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@ build-pass

//! Regression test #124478.

use std::mem::offset_of;

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

impl S {
    fn return_static_slice() -> &'static [usize] {
        &[offset_of!(Self, v), offset_of!(Self, w)]
    }
    fn use_reference() -> usize {
        let r = &offset_of!(Self, v);
        *r * 6
    }
}

fn main() {
}