File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,7 @@ impl Config {
405405 config. incremental = flags. incremental ;
406406 config. dry_run = flags. dry_run ;
407407 config. keep_stage = flags. keep_stage ;
408- if let Some ( value) = flags. warnings {
408+ if let Some ( value) = flags. deny_warnings {
409409 config. deny_warnings = value;
410410 }
411411
@@ -571,7 +571,7 @@ impl Config {
571571 config. rustc_default_linker = rust. default_linker . clone ( ) ;
572572 config. musl_root = rust. musl_root . clone ( ) . map ( PathBuf :: from) ;
573573 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 ) ) ;
575575 set ( & mut config. backtrace_on_ice , rust. backtrace_on_ice ) ;
576576 set ( & mut config. rust_verify_llvm_ir , rust. verify_llvm_ir ) ;
577577 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 {
3333 pub rustc_error_format : Option < String > ,
3434 pub dry_run : bool ,
3535
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 > ,
3841}
3942
4043pub enum Subcommand {
@@ -468,7 +471,7 @@ Arguments:
468471 . into_iter ( )
469472 . map ( |p| p. into ( ) )
470473 . collect :: < Vec < _ > > ( ) ,
471- warnings : matches . opt_str ( "warnings" ) . map ( |v| v == "deny" ) ,
474+ deny_warnings : parse_deny_warnings ( & matches ) ,
472475 }
473476 }
474477}
@@ -549,3 +552,18 @@ fn split(s: &[String]) -> Vec<String> {
549552 . map ( |s| s. to_string ( ) )
550553 . collect ( )
551554}
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