Skip to content

Commit b9dbb81

Browse files
committed
Improve example used for SB tests
1 parent 7a52e73 commit b9dbb81

File tree

4 files changed

+47
-19
lines changed

4 files changed

+47
-19
lines changed

src/test/mir-opt/dataflow-const-prop/ref_with_sb.main.DataflowConstProp.diff

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
let _2: (); // in scope 0 at $DIR/ref_with_sb.rs:+2:5: +2:15
88
let mut _3: &i32; // in scope 0 at $DIR/ref_with_sb.rs:+2:12: +2:14
99
let _4: &i32; // in scope 0 at $DIR/ref_with_sb.rs:+2:12: +2:14
10+
let _5: (); // in scope 0 at $DIR/ref_with_sb.rs:+4:5: +4:20
1011
scope 1 {
1112
debug a => _1; // in scope 1 at $DIR/ref_with_sb.rs:+1:9: +1:14
12-
let _5: i32; // in scope 1 at $DIR/ref_with_sb.rs:+6:9: +6:10
13+
let _6: i32; // in scope 1 at $DIR/ref_with_sb.rs:+7:9: +7:10
1314
scope 2 {
14-
debug b => _5; // in scope 2 at $DIR/ref_with_sb.rs:+6:9: +6:10
15+
debug b => _6; // in scope 2 at $DIR/ref_with_sb.rs:+7:9: +7:10
1516
}
1617
}
1718

@@ -25,7 +26,7 @@
2526
_3 = &(*_4); // scope 1 at $DIR/ref_with_sb.rs:+2:12: +2:14
2627
_2 = escape::<i32>(move _3) -> bb1; // scope 1 at $DIR/ref_with_sb.rs:+2:5: +2:15
2728
// mir::Constant
28-
// + span: $DIR/ref_with_sb.rs:10:5: 10:11
29+
// + span: $DIR/ref_with_sb.rs:13:5: 13:11
2930
// + literal: Const { ty: for<'a> fn(&'a i32) {escape::<i32>}, val: Value(<ZST>) }
3031
}
3132

@@ -34,13 +35,22 @@
3435
StorageDead(_4); // scope 1 at $DIR/ref_with_sb.rs:+2:15: +2:16
3536
StorageDead(_2); // scope 1 at $DIR/ref_with_sb.rs:+2:15: +2:16
3637
_1 = const 1_i32; // scope 1 at $DIR/ref_with_sb.rs:+3:5: +3:10
37-
StorageLive(_5); // scope 1 at $DIR/ref_with_sb.rs:+6:9: +6:10
38-
- _5 = _1; // scope 1 at $DIR/ref_with_sb.rs:+6:13: +6:14
39-
+ _5 = const 1_i32; // scope 1 at $DIR/ref_with_sb.rs:+6:13: +6:14
40-
_0 = const (); // scope 0 at $DIR/ref_with_sb.rs:+0:11: +7:2
41-
StorageDead(_5); // scope 1 at $DIR/ref_with_sb.rs:+7:1: +7:2
42-
StorageDead(_1); // scope 0 at $DIR/ref_with_sb.rs:+7:1: +7:2
43-
return; // scope 0 at $DIR/ref_with_sb.rs:+7:2: +7:2
38+
StorageLive(_5); // scope 1 at $DIR/ref_with_sb.rs:+4:5: +4:20
39+
_5 = some_function() -> bb2; // scope 1 at $DIR/ref_with_sb.rs:+4:5: +4:20
40+
// mir::Constant
41+
// + span: $DIR/ref_with_sb.rs:15:5: 15:18
42+
// + literal: Const { ty: fn() {some_function}, val: Value(<ZST>) }
43+
}
44+
45+
bb2: {
46+
StorageDead(_5); // scope 1 at $DIR/ref_with_sb.rs:+4:20: +4:21
47+
StorageLive(_6); // scope 1 at $DIR/ref_with_sb.rs:+7:9: +7:10
48+
- _6 = _1; // scope 1 at $DIR/ref_with_sb.rs:+7:13: +7:14
49+
+ _6 = const 1_i32; // scope 1 at $DIR/ref_with_sb.rs:+7:13: +7:14
50+
_0 = const (); // scope 0 at $DIR/ref_with_sb.rs:+0:11: +8:2
51+
StorageDead(_6); // scope 1 at $DIR/ref_with_sb.rs:+8:1: +8:2
52+
StorageDead(_1); // scope 0 at $DIR/ref_with_sb.rs:+8:1: +8:2
53+
return; // scope 0 at $DIR/ref_with_sb.rs:+8:2: +8:2
4454
}
4555
}
4656

src/test/mir-opt/dataflow-const-prop/ref_with_sb.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
#[inline(never)]
55
fn escape<T>(x: &T) {}
66

7+
#[inline(never)]
8+
fn some_function() {}
9+
710
// EMIT_MIR ref_with_sb.main.DataflowConstProp.diff
811
fn main() {
912
let mut a = 0;
1013
escape(&a);
1114
a = 1;
15+
some_function();
1216
// With `-Zunsound-mir-opt`, this should be propagated
1317
// (because we assume Stacked Borrows).
1418
let b = a;

src/test/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
let _2: (); // in scope 0 at $DIR/ref_without_sb.rs:+2:5: +2:15
88
let mut _3: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14
99
let _4: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14
10+
let _5: (); // in scope 0 at $DIR/ref_without_sb.rs:+4:5: +4:20
1011
scope 1 {
1112
debug a => _1; // in scope 1 at $DIR/ref_without_sb.rs:+1:9: +1:14
12-
let _5: i32; // in scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10
13+
let _6: i32; // in scope 1 at $DIR/ref_without_sb.rs:+7:9: +7:10
1314
scope 2 {
14-
debug b => _5; // in scope 2 at $DIR/ref_without_sb.rs:+6:9: +6:10
15+
debug b => _6; // in scope 2 at $DIR/ref_without_sb.rs:+7:9: +7:10
1516
}
1617
}
1718

@@ -25,7 +26,7 @@
2526
_3 = &(*_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14
2627
_2 = escape::<i32>(move _3) -> bb1; // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15
2728
// mir::Constant
28-
// + span: $DIR/ref_without_sb.rs:9:5: 9:11
29+
// + span: $DIR/ref_without_sb.rs:12:5: 12:11
2930
// + literal: Const { ty: for<'a> fn(&'a i32) {escape::<i32>}, val: Value(<ZST>) }
3031
}
3132

@@ -34,12 +35,21 @@
3435
StorageDead(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16
3536
StorageDead(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16
3637
_1 = const 1_i32; // scope 1 at $DIR/ref_without_sb.rs:+3:5: +3:10
37-
StorageLive(_5); // scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10
38-
_5 = _1; // scope 1 at $DIR/ref_without_sb.rs:+6:13: +6:14
39-
_0 = const (); // scope 0 at $DIR/ref_without_sb.rs:+0:11: +7:2
40-
StorageDead(_5); // scope 1 at $DIR/ref_without_sb.rs:+7:1: +7:2
41-
StorageDead(_1); // scope 0 at $DIR/ref_without_sb.rs:+7:1: +7:2
42-
return; // scope 0 at $DIR/ref_without_sb.rs:+7:2: +7:2
38+
StorageLive(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20
39+
_5 = some_function() -> bb2; // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20
40+
// mir::Constant
41+
// + span: $DIR/ref_without_sb.rs:14:5: 14:18
42+
// + literal: Const { ty: fn() {some_function}, val: Value(<ZST>) }
43+
}
44+
45+
bb2: {
46+
StorageDead(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:20: +4:21
47+
StorageLive(_6); // scope 1 at $DIR/ref_without_sb.rs:+7:9: +7:10
48+
_6 = _1; // scope 1 at $DIR/ref_without_sb.rs:+7:13: +7:14
49+
_0 = const (); // scope 0 at $DIR/ref_without_sb.rs:+0:11: +8:2
50+
StorageDead(_6); // scope 1 at $DIR/ref_without_sb.rs:+8:1: +8:2
51+
StorageDead(_1); // scope 0 at $DIR/ref_without_sb.rs:+8:1: +8:2
52+
return; // scope 0 at $DIR/ref_without_sb.rs:+8:2: +8:2
4353
}
4454
}
4555

src/test/mir-opt/dataflow-const-prop/ref_without_sb.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
#[inline(never)]
44
fn escape<T>(x: &T) {}
55

6+
#[inline(never)]
7+
fn some_function() {}
8+
69
// EMIT_MIR ref_without_sb.main.DataflowConstProp.diff
710
fn main() {
811
let mut a = 0;
912
escape(&a);
1013
a = 1;
14+
some_function();
1115
// Without `-Zunsound-mir-opt`, this should not be propagated
1216
// (because we do not assume Stacked Borrows).
1317
let b = a;

0 commit comments

Comments
 (0)