Skip to content

Commit 808e039

Browse files
committed
Fix ICE with trans of calls to foreign fns
It was failing occasionally.
1 parent 10935de commit 808e039

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc/middle/trans/callee.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ fn trans<'a>(bcx: &'a Block<'a>, expr: &ast::Expr) -> Callee<'a> {
141141
let expr_ty = node_id_type(bcx, ref_expr.id);
142142
match def {
143143
def::DefFn(did, _) if {
144-
let def_id = inline::maybe_instantiate_inline(bcx.ccx(), did);
145-
match bcx.tcx().map.find(def_id.node) {
144+
let maybe_def_id = inline::get_local_instance(bcx.ccx(), did);
145+
let maybe_ast_node = maybe_def_id.and_then(|def_id| bcx.tcx().map
146+
.find(def_id.node));
147+
match maybe_ast_node {
146148
Some(ast_map::NodeStructCtor(_)) => true,
147149
_ => false
148150
}

0 commit comments

Comments
 (0)