@@ -875,6 +875,28 @@ impl<'a> Builder<'a> {
875
875
extra_args. push_str ( "-Zforce-unstable-if-unmarked" ) ;
876
876
}
877
877
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
+
878
900
if !extra_args. is_empty ( ) {
879
901
cargo. env (
880
902
"RUSTFLAGS" ,
@@ -1038,10 +1060,6 @@ impl<'a> Builder<'a> {
1038
1060
1039
1061
cargo. env ( "RUSTC_VERBOSE" , self . verbosity . to_string ( ) ) ;
1040
1062
1041
- if self . config . deny_warnings {
1042
- cargo. env ( "RUSTC_DENY_WARNINGS" , "1" ) ;
1043
- }
1044
-
1045
1063
// Throughout the build Cargo can execute a number of build scripts
1046
1064
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
1047
1065
// obtained previously to those build scripts.
0 commit comments