@@ -355,6 +355,7 @@ mod desc {
355
355
pub const parse_sanitizer_memory_track_origins: & str = "0, 1, or 2" ;
356
356
pub const parse_cfguard: & str =
357
357
"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`" ;
358
359
pub const parse_strip: & str = "either `none`, `debuginfo`, or `symbols`" ;
359
360
pub const parse_linker_flavor: & str = :: rustc_target:: spec:: LinkerFlavor :: one_of ( ) ;
360
361
pub const parse_optimization_fuel: & str = "crate=integer" ;
@@ -509,17 +510,6 @@ mod parse {
509
510
}
510
511
}
511
512
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
-
523
513
/// Use this for any numeric option that lacks a static default.
524
514
crate fn parse_opt_number < T : Copy + FromStr > ( slot : & mut Option < T > , v : Option < & str > ) -> bool {
525
515
match v {
@@ -633,6 +623,18 @@ mod parse {
633
623
true
634
624
}
635
625
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
+
636
638
crate fn parse_linker_flavor ( slot : & mut Option < LinkerFlavor > , v : Option < & str > ) -> bool {
637
639
match v. and_then ( LinkerFlavor :: from_str) {
638
640
Some ( lf) => * slot = Some ( lf) ,
@@ -905,9 +907,9 @@ options! {
905
907
"use Windows Control Flow Guard (default: no)" ) ,
906
908
debug_assertions: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
907
909
"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)") ,
911
913
default_linker_libraries: bool = ( false , parse_bool, [ UNTRACKED ] ,
912
914
"allow the linker to link its default libraries (default: no)" ) ,
913
915
embed_bitcode: bool = ( true , parse_bool, [ TRACKED ] ,
0 commit comments