]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/const_prop_miscompile.rs
Do not eagerly recover for bad impl-trait in macros
[rust.git] / tests / mir-opt / const_prop_miscompile.rs
1 // unit-test: ConstProp
2 #![feature(raw_ref_op)]
3
4 // EMIT_MIR const_prop_miscompile.foo.ConstProp.diff
5 fn foo() {
6     let mut u = (1,);
7     *&mut u.0 = 5;
8     let y = { u.0 } == 5;
9 }
10
11 // EMIT_MIR const_prop_miscompile.bar.ConstProp.diff
12 fn bar() {
13     let mut v = (1,);
14     unsafe {
15         *&raw mut v.0 = 5;
16     }
17     let y = { v.0 } == 5;
18 }
19
20 fn main() {
21     foo();
22     bar();
23 }