Skip to content

Commit e43649f

Browse files
bless
1 parent 3c9549b commit e43649f

6 files changed

+79
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
- // MIR for `call` before Inline
2+
+ // MIR for `call` after Inline
3+
4+
fn call(_1: Box<dyn FnMut<I, Output = ()>>, _2: I) -> () {
5+
debug mock => _1;
6+
debug input => _2;
7+
let mut _0: ();
8+
let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>;
9+
let mut _4: I;
10+
11+
bb0: {
12+
StorageLive(_3);
13+
_3 = &mut _1;
14+
StorageLive(_4);
15+
_4 = move _2;
16+
_0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind: bb3];
17+
}
18+
19+
bb1: {
20+
StorageDead(_4);
21+
StorageDead(_3);
22+
drop(_1) -> [return: bb2, unwind: bb4];
23+
}
24+
25+
bb2: {
26+
return;
27+
}
28+
29+
bb3 (cleanup): {
30+
drop(_1) -> [return: bb4, unwind terminate];
31+
}
32+
33+
bb4 (cleanup): {
34+
resume;
35+
}
36+
}
37+

tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
12
// compile-flags: -Zmir-enable-passes=+Inline --crate-type=lib
23

34
#![feature(fn_traits, tuple_trait, unboxed_closures)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
- // MIR for `call` before Inline
2+
+ // MIR for `call` after Inline
3+
4+
fn call(_1: Box<dyn Fn(i32)>) -> () {
5+
debug x => _1;
6+
let mut _0: ();
7+
let _2: ();
8+
let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>;
9+
let mut _4: (i32,);
10+
11+
bb0: {
12+
StorageLive(_2);
13+
StorageLive(_3);
14+
_3 = &_1;
15+
StorageLive(_4);
16+
_4 = (const 1_i32,);
17+
_2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind: bb3];
18+
}
19+
20+
bb1: {
21+
StorageDead(_4);
22+
StorageDead(_3);
23+
StorageDead(_2);
24+
_0 = const ();
25+
drop(_1) -> [return: bb2, unwind: bb4];
26+
}
27+
28+
bb2: {
29+
return;
30+
}
31+
32+
bb3 (cleanup): {
33+
drop(_1) -> [return: bb4, unwind terminate];
34+
}
35+
36+
bb4 (cleanup): {
37+
resume;
38+
}
39+
}
40+

tests/mir-opt/inline/inline_box_fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
12
// unit-test: Inline
23
// compile-flags: --crate-type=lib
34

0 commit comments

Comments
 (0)