blob: e1cf2dc53869ba7c0039e2119998bf64ef43d863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// check-pass
#![feature(raw_ref_op)]
fn mutable_address_of() {
let mut x = 0;
let y = &raw mut x;
}
fn mutable_address_of_closure() {
let mut x = 0;
let mut f = || {
let y = &raw mut x;
};
f();
}
fn const_address_of_closure() {
let x = 0;
let f = || {
let y = &raw const x;
};
f();
}
fn make_fn<F: Fn()>(f: F) -> F { f }
fn const_address_of_fn_closure() {
let x = 0;
let f = make_fn(|| {
let y = &raw const x;
});
f();
}
fn const_address_of_fn_closure_move() {
let x = 0;
let f = make_fn(move || {
let y = &raw const x;
});
f();
}
fn main() {}
|