]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/const_prop_miscompile.rs
Test drop_tracking_mir before querying generator.
[rust.git] / tests / mir-opt / const_prop_miscompile.rs
1 #![feature(raw_ref_op)]
2
3 // EMIT_MIR const_prop_miscompile.foo.ConstProp.diff
4 fn foo() {
5     let mut u = (1,);
6     *&mut u.0 = 5;
7     let y = { u.0 } == 5;
8 }
9
10 // EMIT_MIR const_prop_miscompile.bar.ConstProp.diff
11 fn bar() {
12     let mut v = (1,);
13     unsafe {
14         *&raw mut v.0 = 5;
15     }
16     let y = { v.0 } == 5;
17 }
18
19 fn main() {
20     foo();
21     bar();
22 }