1
- // skip-filecheck
2
1
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3
2
// Check that CopyProp considers reborrows as not mutating the pointer.
4
3
//@ test-mir-pass: CopyProp
@@ -8,6 +7,9 @@ fn opaque(_: impl Sized) {}
8
7
9
8
// EMIT_MIR reborrow.remut.CopyProp.diff
10
9
fn remut ( mut x : u8 ) {
10
+ // CHECK-LABEL: fn remut(
11
+ // CHECK: debug a => [[a:_.*]];
12
+ // CHECK: debug c => [[a]];
11
13
let a = & mut x;
12
14
let b = & mut * a; //< this cannot mutate a.
13
15
let c = a; //< so `c` and `a` can be merged.
@@ -16,6 +18,9 @@ fn remut(mut x: u8) {
16
18
17
19
// EMIT_MIR reborrow.reraw.CopyProp.diff
18
20
fn reraw ( mut x : u8 ) {
21
+ // CHECK-LABEL: fn reraw(
22
+ // CHECK: debug a => [[a:_.*]];
23
+ // CHECK: debug c => [[a]];
19
24
let a = & mut x;
20
25
let b = & raw mut * a; //< this cannot mutate a.
21
26
let c = a; //< so `c` and `a` can be merged.
@@ -24,6 +29,9 @@ fn reraw(mut x: u8) {
24
29
25
30
// EMIT_MIR reborrow.miraw.CopyProp.diff
26
31
fn miraw ( mut x : u8 ) {
32
+ // CHECK-LABEL: fn miraw(
33
+ // CHECK: debug a => [[a:_.*]];
34
+ // CHECK: debug c => [[a]];
27
35
let a = & raw mut x;
28
36
let b = unsafe { & raw mut * a } ; //< this cannot mutate a.
29
37
let c = a; //< so `c` and `a` can be merged.
@@ -32,6 +40,9 @@ fn miraw(mut x: u8) {
32
40
33
41
// EMIT_MIR reborrow.demiraw.CopyProp.diff
34
42
fn demiraw ( mut x : u8 ) {
43
+ // CHECK-LABEL: fn demiraw(
44
+ // CHECK: debug a => [[a:_.*]];
45
+ // CHECK: debug c => [[a]];
35
46
let a = & raw mut x;
36
47
let b = unsafe { & mut * a } ; //< this cannot mutate a.
37
48
let c = a; //< so `c` and `a` can be merged.
0 commit comments