Skip to content

Commit 025b27d

Browse files
debuginfo: Erase regions when creating debuginfo for statics.
1 parent 7ef418b commit 025b27d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc_trans/debuginfo/metadata.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1771,15 +1771,17 @@ pub fn create_global_var_metadata(cx: &CrateContext,
17711771
return;
17721772
}
17731773

1774+
let tcx = cx.tcx();
1775+
17741776
// Don't create debuginfo for globals inlined from other crates. The other
17751777
// crate should already contain debuginfo for it. More importantly, the
17761778
// global might not even exist in un-inlined form anywhere which would lead
17771779
// to a linker errors.
1778-
if cx.tcx().map.is_inlined_node_id(node_id) {
1780+
if tcx.map.is_inlined_node_id(node_id) {
17791781
return;
17801782
}
17811783

1782-
let node_def_id = cx.tcx().map.local_def_id(node_id);
1784+
let node_def_id = tcx.map.local_def_id(node_id);
17831785
let (var_scope, span) = get_namespace_and_span_for_item(cx, node_def_id);
17841786

17851787
let (file_metadata, line_number) = if span != syntax_pos::DUMMY_SP {
@@ -1790,9 +1792,9 @@ pub fn create_global_var_metadata(cx: &CrateContext,
17901792
};
17911793

17921794
let is_local_to_unit = is_node_local_to_unit(cx, node_id);
1793-
let variable_type = cx.tcx().node_id_to_type(node_id);
1795+
let variable_type = tcx.erase_regions(&tcx.node_id_to_type(node_id));
17941796
let type_metadata = type_metadata(cx, variable_type, span);
1795-
let var_name = cx.tcx().item_name(node_def_id).to_string();
1797+
let var_name = tcx.item_name(node_def_id).to_string();
17961798
let linkage_name = mangled_name_of_item(cx, node_def_id, "");
17971799

17981800
let var_name = CString::new(var_name).unwrap();

0 commit comments

Comments
 (0)