Manually inline a function that was only used once
This commit is contained in:
parent
daa53a52a2
commit
1dc4e417fa
2 changed files with 5 additions and 15 deletions
|
|
@ -2946,16 +2946,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Given the DefId of an item, returns its MIR, borrowed immutably.
|
||||
/// Returns None if there is no MIR for the DefId
|
||||
pub fn maybe_optimized_mir(self, did: DefId) -> Option<&'gcx Mir<'gcx>> {
|
||||
if self.is_mir_available(did) {
|
||||
Some(self.optimized_mir(did))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the attributes of a definition.
|
||||
pub fn get_attrs(self, did: DefId) -> Attributes<'gcx> {
|
||||
if let Some(id) = self.hir().as_local_node_id(did) {
|
||||
|
|
|
|||
|
|
@ -265,11 +265,11 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
|
|||
}
|
||||
trace!("load mir {:?}", instance);
|
||||
match instance {
|
||||
ty::InstanceDef::Item(def_id) => {
|
||||
self.tcx.maybe_optimized_mir(def_id).ok_or_else(||
|
||||
EvalErrorKind::NoMirFor(self.tcx.item_path_str(def_id)).into()
|
||||
)
|
||||
}
|
||||
ty::InstanceDef::Item(def_id) => if self.tcx.is_mir_available(did) {
|
||||
Ok(self.tcx.optimized_mir(did))
|
||||
} else {
|
||||
err!(NoMirFor(self.tcx.item_path_str(def_id)))
|
||||
},
|
||||
_ => Ok(self.tcx.instance_mir(instance)),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue