@@ -875,6 +875,28 @@ impl<'a> Builder<'a> {
875875 extra_args. push_str ( "-Zforce-unstable-if-unmarked" ) ;
876876 }
877877
878+ match mode {
879+ Mode :: ToolStd { in_tree : true } |
880+ Mode :: ToolRustc { in_tree : true } |
881+ Mode :: ToolBootstrap { in_tree : true } |
882+ Mode :: Std |
883+ Mode :: Rustc |
884+ Mode :: Codegen => {
885+ // When extending this list, add the new lints to the RUSTFLAGS of the
886+ // build_bootstrap function of src/bootstrap/bootstrap.py as well as
887+ // some code doesn't go through this `rustc` wrapper.
888+ extra_args. push_str ( " -Wrust_2018_idioms" ) ;
889+ extra_args. push_str ( " -Wunused_lifetimes" ) ;
890+ }
891+ Mode :: ToolStd { in_tree : false } |
892+ Mode :: ToolRustc { in_tree : false } |
893+ Mode :: ToolBootstrap { in_tree : false } => { }
894+ }
895+
896+ if self . config . deny_warnings {
897+ extra_args. push_str ( " -Dwarnings" ) ;
898+ }
899+
878900 if !extra_args. is_empty ( ) {
879901 cargo. env (
880902 "RUSTFLAGS" ,
@@ -1038,10 +1060,6 @@ impl<'a> Builder<'a> {
10381060
10391061 cargo. env ( "RUSTC_VERBOSE" , self . verbosity . to_string ( ) ) ;
10401062
1041- if self . config . deny_warnings {
1042- cargo. env ( "RUSTC_DENY_WARNINGS" , "1" ) ;
1043- }
1044-
10451063 // Throughout the build Cargo can execute a number of build scripts
10461064 // compiling C/C++ code and we need to pass compilers, archivers, flags, etc
10471065 // obtained previously to those build scripts.
0 commit comments