Skip to content

Commit 5eb302f

Browse files
committed
always use resolve
1 parent 3bd09de commit 5eb302f

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/librustc_mir/transform/inline.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,17 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
8787
let terminator = bb_data.terminator();
8888
if let TerminatorKind::Call {
8989
func: Operand::Constant(ref f), .. } = terminator.kind {
90-
if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty {
91-
match self.tcx.trait_of_item(callee_def_id) {
92-
Some(_) => {
93-
match Instance::new(callee_def_id, substs).resolve(self.tcx) {
94-
Some(instance) => {
95-
callsites.push_back(CallSite {
96-
callee: instance.def_id(),
97-
substs: instance.substs,
98-
bb,
99-
location: terminator.source_info
100-
});
101-
},
102-
None => {}
103-
}
104-
}
105-
None => {
90+
if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty {
91+
if let Some(instance) = Instance::new(callee_def_id, substs).resolve(self.tcx) {
10692
callsites.push_back(CallSite {
107-
callee: callee_def_id,
108-
substs,
93+
callee: instance.def_id(),
94+
substs: instance.substs,
10995
bb,
11096
location: terminator.source_info
11197
});
11298
}
11399
}
114100
}
115-
}
116101
}
117102
}
118103

0 commit comments

Comments
 (0)