File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
src/librustc/middle/trans Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -798,15 +798,16 @@ pub fn create_global_var_metadata(cx: &CrateContext,
798798 var_item) . as_slice ( ) )
799799 } ;
800800
801- let filename = span_start ( cx, span) . file . name . clone ( ) ;
802- let file_metadata = file_metadata ( cx, filename. as_slice ( ) ) ;
801+ let ( file_metadata, line_number) = if span != codemap:: DUMMY_SP {
802+ let loc = span_start ( cx, span) ;
803+ ( file_metadata ( cx, loc. file . name . as_slice ( ) ) , loc. line as c_uint )
804+ } else {
805+ ( UNKNOWN_FILE_METADATA , UNKNOWN_LINE_NUMBER )
806+ } ;
803807
804808 let is_local_to_unit = is_node_local_to_unit ( cx, node_id) ;
805- let loc = span_start ( cx, span) ;
806-
807809 let variable_type = ty:: node_id_to_type ( cx. tcx ( ) , node_id) ;
808810 let type_metadata = type_metadata ( cx, variable_type, span) ;
809-
810811 let namespace_node = namespace_for_item ( cx, ast_util:: local_def ( node_id) ) ;
811812 let var_name = token:: get_ident ( ident) . get ( ) . to_string ( ) ;
812813 let linkage_name =
@@ -821,7 +822,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
821822 var_name,
822823 linkage_name,
823824 file_metadata,
824- loc . line as c_uint ,
825+ line_number ,
825826 type_metadata,
826827 is_local_to_unit,
827828 global,
You can’t perform that action at this time.
0 commit comments