ugly, but works!
This commit is contained in:
parent
b413596da6
commit
784e4316eb
1 changed files with 16 additions and 6 deletions
|
|
@ -88,12 +88,22 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
|||
if let TerminatorKind::Call {
|
||||
func: Operand::Constant(ref f), .. } = terminator.kind {
|
||||
if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty {
|
||||
callsites.push_back(CallSite {
|
||||
callee: callee_def_id,
|
||||
substs,
|
||||
bb,
|
||||
location: terminator.source_info
|
||||
});
|
||||
let should_inline = match self.tcx.opt_associated_item(callee_def_id) {
|
||||
Some(item) => match item.container {
|
||||
ty::AssociatedItemContainer::ImplContainer(_) => true,
|
||||
ty::AssociatedItemContainer::TraitContainer(_) => false,
|
||||
},
|
||||
None => true
|
||||
};
|
||||
|
||||
if should_inline {
|
||||
callsites.push_back(CallSite {
|
||||
callee: callee_def_id,
|
||||
substs,
|
||||
bb,
|
||||
location: terminator.source_info
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue