]> git.lizzy.rs Git - rust.git/commitdiff
Fix ICE with trans of calls to foreign fns
authorPiotr Czarnecki <pioczarn@gmail.com>
Sat, 6 Sep 2014 00:46:05 +0000 (01:46 +0100)
committerPiotr Czarnecki <pioczarn@gmail.com>
Sat, 6 Sep 2014 11:31:05 +0000 (12:31 +0100)
It was failing occasionally.

src/librustc/middle/trans/callee.rs

index 8909527f0c499a4767b850780fa2c2b7bedea2b5..794e42563a9f0c8e2d3f116027873c191e9fc709 100644 (file)
@@ -141,8 +141,10 @@ fn trans_def<'a>(bcx: &'a Block<'a>, def: def::Def, ref_expr: &ast::Expr)
         let expr_ty = node_id_type(bcx, ref_expr.id);
         match def {
             def::DefFn(did, _) if {
-                let def_id = inline::maybe_instantiate_inline(bcx.ccx(), did);
-                match bcx.tcx().map.find(def_id.node) {
+                let maybe_def_id = inline::get_local_instance(bcx.ccx(), did);
+                let maybe_ast_node = maybe_def_id.and_then(|def_id| bcx.tcx().map
+                                                                             .find(def_id.node));
+                match maybe_ast_node {
                     Some(ast_map::NodeStructCtor(_)) => true,
                     _ => false
                 }