File tree 2 files changed +23
-5
lines changed
2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,7 @@ impl Config {
405
405
config. incremental = flags. incremental ;
406
406
config. dry_run = flags. dry_run ;
407
407
config. keep_stage = flags. keep_stage ;
408
- if let Some ( value) = flags. warnings {
408
+ if let Some ( value) = flags. deny_warnings {
409
409
config. deny_warnings = value;
410
410
}
411
411
@@ -571,7 +571,7 @@ impl Config {
571
571
config. rustc_default_linker = rust. default_linker . clone ( ) ;
572
572
config. musl_root = rust. musl_root . clone ( ) . map ( PathBuf :: from) ;
573
573
config. save_toolstates = rust. save_toolstates . clone ( ) . map ( PathBuf :: from) ;
574
- set ( & mut config. deny_warnings , rust . deny_warnings . or ( flags . warnings ) ) ;
574
+ set ( & mut config. deny_warnings , flags . deny_warnings . or ( rust . deny_warnings ) ) ;
575
575
set ( & mut config. backtrace_on_ice , rust. backtrace_on_ice ) ;
576
576
set ( & mut config. rust_verify_llvm_ir , rust. verify_llvm_ir ) ;
577
577
set ( & mut config. rust_remap_debuginfo , rust. remap_debuginfo ) ;
Original file line number Diff line number Diff line change @@ -33,8 +33,11 @@ pub struct Flags {
33
33
pub rustc_error_format : Option < String > ,
34
34
pub dry_run : bool ,
35
35
36
- // true => deny
37
- pub warnings : Option < bool > ,
36
+ // This overrides the deny-warnings configuation option,
37
+ // which passes -Dwarnings to the compiler invocations.
38
+ //
39
+ // true => deny, false => allow
40
+ pub deny_warnings : Option < bool > ,
38
41
}
39
42
40
43
pub enum Subcommand {
@@ -468,7 +471,7 @@ Arguments:
468
471
. into_iter ( )
469
472
. map ( |p| p. into ( ) )
470
473
. collect :: < Vec < _ > > ( ) ,
471
- warnings : matches . opt_str ( "warnings" ) . map ( |v| v == "deny" ) ,
474
+ deny_warnings : parse_deny_warnings ( & matches ) ,
472
475
}
473
476
}
474
477
}
@@ -549,3 +552,18 @@ fn split(s: &[String]) -> Vec<String> {
549
552
. map ( |s| s. to_string ( ) )
550
553
. collect ( )
551
554
}
555
+
556
+ fn parse_deny_warnings ( matches : & getopts:: Matches ) -> Option < bool > {
557
+ match matches. opt_str ( "warnings" ) . as_ref ( ) . map ( |v| v. as_str ( ) ) {
558
+ Some ( "deny" ) => Some ( true ) ,
559
+ Some ( "allow" ) => Some ( false ) ,
560
+ Some ( value) => {
561
+ eprintln ! (
562
+ r#"invalid value for --warnings: {:?}, expected "allow" or "deny""# ,
563
+ value,
564
+ ) ;
565
+ process:: exit ( 1 ) ;
566
+ } ,
567
+ None => None ,
568
+ }
569
+ }
You can’t perform that action at this time.
0 commit comments