about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPiotr Czarnecki <pioczarn@gmail.com>2014-09-06 01:46:05 +0100
committerPiotr Czarnecki <pioczarn@gmail.com>2014-09-06 12:31:05 +0100
commit808e039d401bfa4a5f22484086409e3861511940 (patch)
treec533aab55ac3b211ddc3bcab621d1a667ecfc5e3
parent10935de0cdb34b9405c71a813cc89eb1cb44fd01 (diff)
downloadrust-808e039d401bfa4a5f22484086409e3861511940.tar.gz
rust-808e039d401bfa4a5f22484086409e3861511940.zip
Fix ICE with trans of calls to foreign fns
It was failing occasionally.
-rw-r--r--src/librustc/middle/trans/callee.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index 8909527f0c4..794e42563a9 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -141,8 +141,10 @@ fn trans<'a>(bcx: &'a Block<'a>, expr: &ast::Expr) -> Callee<'a> {
         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
                 }