Skip to content

Commit 77dac91

Browse files
committed
Add test.
1 parent 6ce2273 commit 77dac91

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
- // MIR for `main` before DeadStoreElimination
2+
+ // MIR for `main` after DeadStoreElimination
3+
4+
fn main() -> () {
5+
let mut _0: (); // return place in scope 0 at $DIR/place_mention.rs:+0:11: +0:11
6+
let mut _1: (&str, &str); // in scope 0 at $DIR/place_mention.rs:+3:18: +3:36
7+
scope 1 {
8+
}
9+
10+
bb0: {
11+
StorageLive(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
12+
- _1 = (const "Hello", const "World"); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
13+
- // mir::Constant
14+
- // + span: $DIR/place_mention.rs:8:19: 8:26
15+
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
16+
- // mir::Constant
17+
- // + span: $DIR/place_mention.rs:8:28: 8:35
18+
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
19+
PlaceMention(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
20+
StorageDead(_1); // scope 0 at $DIR/place_mention.rs:+3:36: +3:37
21+
_0 = const (); // scope 0 at $DIR/place_mention.rs:+0:11: +4:2
22+
return; // scope 0 at $DIR/place_mention.rs:+4:2: +4:2
23+
}
24+
}
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// unit-test: DeadStoreElimination
2+
// compile-flags: -Zmir-keep-place-mention
3+
4+
// EMIT_MIR place_mention.main.DeadStoreElimination.diff
5+
fn main() {
6+
// Verify that we account for the `PlaceMention` statement as a use of the tuple,
7+
// and don't remove it as a dead store.
8+
let (_, _) = ("Hello", "World");
9+
}

0 commit comments

Comments
 (0)