@@ -38,7 +38,6 @@ use rustc_target::abi::{LayoutOf, Primitive, Size};
3838use libc:: c_uint;
3939use smallvec:: SmallVec ;
4040use std:: cell:: RefCell ;
41- use std:: num:: NonZeroU32 ;
4241use tracing:: debug;
4342
4443mod create_scope_map;
@@ -225,9 +224,9 @@ pub struct DebugLoc {
225224 /// Information about the original source file.
226225 pub file : Lrc < SourceFile > ,
227226 /// The (1-based) line number.
228- pub line : Option < NonZeroU32 > ,
227+ pub line : u32 ,
229228 /// The (1-based) column number.
230- pub col : Option < NonZeroU32 > ,
229+ pub col : u32 ,
231230}
232231
233232impl CodegenCx < ' ll , ' _ > {
@@ -244,16 +243,16 @@ impl CodegenCx<'ll, '_> {
244243 let line = ( line + 1 ) as u32 ;
245244 let col = ( pos - line_pos) . to_u32 ( ) + 1 ;
246245
247- ( file, NonZeroU32 :: new ( line) , NonZeroU32 :: new ( col) )
246+ ( file, line, col)
248247 }
249- Err ( file) => ( file, None , None ) ,
248+ Err ( file) => ( file, UNKNOWN_LINE_NUMBER , UNKNOWN_COLUMN_NUMBER ) ,
250249 } ;
251250
252251 // For MSVC, omit the column number.
253252 // Otherwise, emit it. This mimics clang behaviour.
254253 // See discussion in https://github.com/rust-lang/rust/issues/42921
255254 if self . sess ( ) . target . is_like_msvc {
256- DebugLoc { file, line, col : None }
255+ DebugLoc { file, line, col : UNKNOWN_COLUMN_NUMBER }
257256 } else {
258257 DebugLoc { file, line, col }
259258 }
@@ -359,9 +358,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
359358 linkage_name. as_ptr ( ) . cast ( ) ,
360359 linkage_name. len ( ) ,
361360 file_metadata,
362- loc. line . map_or ( UNKNOWN_LINE_NUMBER , |n| n . get ( ) ) ,
361+ loc. line ,
363362 function_type_metadata,
364- scope_line. map_or ( UNKNOWN_LINE_NUMBER , |n| n . get ( ) ) ,
363+ scope_line,
365364 flags,
366365 spflags,
367366 maybe_definition_llfn,
@@ -551,14 +550,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
551550 ) -> & ' ll DILocation {
552551 let DebugLoc { line, col, .. } = self . lookup_debug_loc ( span. lo ( ) ) ;
553552
554- unsafe {
555- llvm:: LLVMRustDIBuilderCreateDebugLocation (
556- line. map_or ( UNKNOWN_LINE_NUMBER , |n| n. get ( ) ) ,
557- col. map_or ( UNKNOWN_COLUMN_NUMBER , |n| n. get ( ) ) ,
558- scope,
559- inlined_at,
560- )
561- }
553+ unsafe { llvm:: LLVMRustDIBuilderCreateDebugLocation ( line, col, scope, inlined_at) }
562554 }
563555
564556 fn create_vtable_metadata ( & self , ty : Ty < ' tcx > , vtable : Self :: Value ) {
@@ -607,7 +599,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
607599 name. as_ptr ( ) . cast ( ) ,
608600 name. len ( ) ,
609601 file_metadata,
610- loc. line . map_or ( UNKNOWN_LINE_NUMBER , |n| n . get ( ) ) ,
602+ loc. line ,
611603 type_metadata,
612604 true ,
613605 DIFlags :: FlagZero ,
0 commit comments