@@ -355,6 +355,7 @@ mod desc {
355355 pub const parse_sanitizer_memory_track_origins: & str = "0, 1, or 2" ;
356356 pub const parse_cfguard: & str =
357357 "either a boolean (`yes`, `no`, `on`, `off`, etc), `checks`, or `nochecks`" ;
358+ pub const parse_debuginfo: & str = "either an integer (0, 1, 2), `none`, `line-directives-only`, `line-tables-only`, `limited`, or `full`" ;
358359 pub const parse_strip: & str = "either `none`, `debuginfo`, or `symbols`" ;
359360 pub const parse_linker_flavor: & str = :: rustc_target:: spec:: LinkerFlavor :: one_of ( ) ;
360361 pub const parse_optimization_fuel: & str = "crate=integer" ;
@@ -509,17 +510,6 @@ mod parse {
509510 }
510511 }
511512
512- /// Use this for any numeric option that has a static default.
513- crate fn parse_number < T : Copy + FromStr > ( slot : & mut T , v : Option < & str > ) -> bool {
514- match v. and_then ( |s| s. parse ( ) . ok ( ) ) {
515- Some ( i) => {
516- * slot = i;
517- true
518- }
519- None => false ,
520- }
521- }
522-
523513 /// Use this for any numeric option that lacks a static default.
524514 crate fn parse_opt_number < T : Copy + FromStr > ( slot : & mut Option < T > , v : Option < & str > ) -> bool {
525515 match v {
@@ -633,6 +623,18 @@ mod parse {
633623 true
634624 }
635625
626+ crate fn parse_debuginfo ( slot : & mut DebugInfo , v : Option < & str > ) -> bool {
627+ match v {
628+ Some ( "0" ) | Some ( "none" ) => * slot = DebugInfo :: None ,
629+ Some ( "line-directives-only" ) => * slot = DebugInfo :: LineDirectivesOnly ,
630+ Some ( "line-tables-only" ) => * slot = DebugInfo :: LineTablesOnly ,
631+ Some ( "1" ) | Some ( "limited" ) => * slot = DebugInfo :: Limited ,
632+ Some ( "2" ) | Some ( "full" ) => * slot = DebugInfo :: Full ,
633+ _ => return false ,
634+ }
635+ true
636+ }
637+
636638 crate fn parse_linker_flavor ( slot : & mut Option < LinkerFlavor > , v : Option < & str > ) -> bool {
637639 match v. and_then ( LinkerFlavor :: from_str) {
638640 Some ( lf) => * slot = Some ( lf) ,
@@ -905,9 +907,9 @@ options! {
905907 "use Windows Control Flow Guard (default: no)" ) ,
906908 debug_assertions: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
907909 "explicitly enable the `cfg(debug_assertions)` directive" ) ,
908- debuginfo: usize = ( 0 , parse_number , [ TRACKED ] ,
909- "debug info emission level (0 = no debug info, 1 = line tables only, \
910- 2 = full debug info with variable and type information ; default: 0)") ,
910+ debuginfo: DebugInfo = ( DebugInfo :: None , parse_debuginfo , [ TRACKED ] ,
911+ "debug info emission level (0-2, none, line-directives- only, \
912+ line-tables-only, limited, or full ; default: 0)") ,
911913 default_linker_libraries: bool = ( false , parse_bool, [ UNTRACKED ] ,
912914 "allow the linker to link its default libraries (default: no)" ) ,
913915 embed_bitcode: bool = ( true , parse_bool, [ TRACKED ] ,
0 commit comments