]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/copy-prop/mutate_through_pointer.rs
Auto merge of #107443 - cjgillot:generator-less-query, r=compiler-errors
[rust.git] / tests / mir-opt / copy-prop / mutate_through_pointer.rs
1 #![feature(custom_mir, core_intrinsics)]
2 #![allow(unused_assignments)]
3 extern crate core;
4 use core::intrinsics::mir::*;
5
6 #[custom_mir(dialect = "analysis", phase = "post-cleanup")]
7 fn f(c: bool) -> bool {
8     mir!({
9         let a = c;
10         let p = core::ptr::addr_of!(a);
11         let p2 = core::ptr::addr_of_mut!(*p);
12         *p2 = false;
13         RET = c;
14         Return()
15     })
16 }
17
18 fn main() {
19     assert_eq!(true, f(true));
20 }
21
22 // EMIT_MIR mutate_through_pointer.f.CopyProp.diff