trans: Make sure that each FnOnce shim is only translated once.
This commit is contained in:
parent
457019967b
commit
2d34ad04ef
1 changed files with 6 additions and 0 deletions
|
|
@ -217,6 +217,10 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
|
|||
llreffn: ValueRef)
|
||||
-> ValueRef
|
||||
{
|
||||
if let Some(&llfn) = ccx.instances().borrow().get(&method_instance) {
|
||||
return llfn;
|
||||
}
|
||||
|
||||
debug!("trans_fn_once_adapter_shim(closure_def_id={:?}, substs={:?}, llreffn={:?})",
|
||||
closure_def_id, substs, Value(llreffn));
|
||||
|
||||
|
|
@ -312,5 +316,7 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
|
|||
|
||||
fcx.finish(bcx, DebugLoc::None);
|
||||
|
||||
ccx.instances().borrow_mut().insert(method_instance, lloncefn);
|
||||
|
||||
lloncefn
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue