]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_trans/trans/debuginfo/mod.rs
Fix the fallout
[rust.git] / src / librustc_trans / trans / debuginfo / mod.rs
index ebd2b7ea41811cca722009cb569708412d3446e3..ee1d834fc8a89efb638a271e2475184e65e21388 100644 (file)
@@ -35,6 +35,7 @@
 use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
 use trans;
 use trans::{monomorphize, type_of};
+use middle::infer;
 use middle::ty::{self, Ty};
 use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
 use util::nodemap::{NodeMap, FnvHashMap, FnvHashSet};
@@ -144,7 +145,7 @@ fn should_be_ignored_message() -> &'static str {
     }
 }
 
-struct FunctionDebugContextData {
+pub struct FunctionDebugContextData {
     scope_map: RefCell<NodeMap<DIScope>>,
     fn_metadata: DISubprogram,
     argument_counter: Cell<usize>,
@@ -252,7 +253,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         }
         hir_map::NodeImplItem(impl_item) => {
             match impl_item.node {
-                hir::MethodImplItem(ref sig, ref body) => {
+                hir::ImplItemKind::Method(ref sig, ref body) => {
                     if contains_nodebug_attribute(&impl_item.attrs) {
                         return FunctionDebugContext::FunctionWithoutDebugInfo;
                     }
@@ -351,7 +352,8 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     // somehow (storing a path in the hir_map, or construct a path using the
     // enclosing function).
     let (linkage_name, containing_scope) = if has_path {
-        let namespace_node = namespace_for_item(cx, DefId::local(fn_ast_id));
+        let fn_ast_def_id = cx.tcx().map.local_def_id(fn_ast_id);
+        let namespace_node = namespace_for_item(cx, fn_ast_def_id);
         let linkage_name = namespace_node.mangled_name_of_contained_item(
             &function_name[..]);
         let containing_scope = namespace_node.scope;
@@ -417,19 +419,23 @@ fn get_function_signature<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         // Return type -- llvm::DIBuilder wants this at index 0
         assert_type_for_node_id(cx, fn_ast_id, error_reporting_span);
         let fn_type = cx.tcx().node_id_to_type(fn_ast_id);
+        let fn_type = monomorphize::apply_param_substs(cx.tcx(), param_substs, &fn_type);
 
         let (sig, abi) = match fn_type.sty {
             ty::TyBareFn(_, ref barefnty) => {
-                (cx.tcx().erase_late_bound_regions(&barefnty.sig), barefnty.abi)
+                let sig = cx.tcx().erase_late_bound_regions(&barefnty.sig);
+                let sig = infer::normalize_associated_type(cx.tcx(), &sig);
+                (sig, barefnty.abi)
             }
             ty::TyClosure(def_id, ref substs) => {
                 let closure_type = cx.tcx().closure_type(def_id, substs);
-                (cx.tcx().erase_late_bound_regions(&closure_type.sig), closure_type.abi)
+                let sig = cx.tcx().erase_late_bound_regions(&closure_type.sig);
+                let sig = infer::normalize_associated_type(cx.tcx(), &sig);
+                (sig, closure_type.abi)
             }
 
             _ => cx.sess().bug("get_function_metdata: Expected a function type!")
         };
-        let sig = monomorphize::apply_param_substs(cx.tcx(), param_substs, &sig);
 
         let mut signature = Vec::with_capacity(sig.inputs.len() + 1);