always use resolve

This commit is contained in:
Douglas Campos 2017-09-19 09:14:43 -04:00
parent 3bd09dee45
commit 5eb302fba8

View File

@ -87,32 +87,17 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
let terminator = bb_data.terminator(); let terminator = bb_data.terminator();
if let TerminatorKind::Call { if let TerminatorKind::Call {
func: Operand::Constant(ref f), .. } = terminator.kind { func: Operand::Constant(ref f), .. } = terminator.kind {
if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty { if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty {
match self.tcx.trait_of_item(callee_def_id) { if let Some(instance) = Instance::new(callee_def_id, substs).resolve(self.tcx) {
Some(_) => {
match Instance::new(callee_def_id, substs).resolve(self.tcx) {
Some(instance) => {
callsites.push_back(CallSite {
callee: instance.def_id(),
substs: instance.substs,
bb,
location: terminator.source_info
});
},
None => {}
}
}
None => {
callsites.push_back(CallSite { callsites.push_back(CallSite {
callee: callee_def_id, callee: instance.def_id(),
substs, substs: instance.substs,
bb, bb,
location: terminator.source_info location: terminator.source_info
}); });
} }
} }
} }
}
} }
} }