@@ -765,7 +765,9 @@ impl<'a> Builder<'a> {
765
765
if cmd == "doc" || cmd == "rustdoc" {
766
766
let my_out = match mode {
767
767
// This is the intended out directory for compiler documentation.
768
- Mode :: Rustc | Mode :: ToolRustc | Mode :: Codegen => self . compiler_doc_out ( target) ,
768
+ Mode :: Rustc | Mode :: ToolRustc { .. } | Mode :: Codegen => {
769
+ self . compiler_doc_out ( target)
770
+ }
769
771
_ => self . crate_doc_out ( target) ,
770
772
} ;
771
773
let rustdoc = self . rustdoc ( compiler) ;
@@ -797,8 +799,8 @@ impl<'a> Builder<'a> {
797
799
}
798
800
799
801
match mode {
800
- Mode :: Std | Mode :: ToolBootstrap | Mode :: ToolStd => { } ,
801
- Mode :: Rustc | Mode :: Codegen | Mode :: ToolRustc => {
802
+ Mode :: Std | Mode :: ToolBootstrap { .. } | Mode :: ToolStd { .. } => { } ,
803
+ Mode :: Rustc | Mode :: Codegen | Mode :: ToolRustc { .. } => {
802
804
// Build proc macros both for the host and the target
803
805
if target != compiler. host && cmd != "check" {
804
806
cargo. arg ( "-Zdual-proc-macros" ) ;
@@ -873,6 +875,28 @@ impl<'a> Builder<'a> {
873
875
extra_args. push_str ( "-Zforce-unstable-if-unmarked" ) ;
874
876
}
875
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
+
876
900
if !extra_args. is_empty ( ) {
877
901
cargo. env (
878
902
"RUSTFLAGS" ,
@@ -891,7 +915,11 @@ impl<'a> Builder<'a> {
891
915
// the stage0 build means it uses libraries build by the stage0
892
916
// compiler, but for tools we just use the precompiled libraries that
893
917
// we've downloaded
894
- let use_snapshot = mode == Mode :: ToolBootstrap ;
918
+ let use_snapshot = if let Mode :: ToolBootstrap { .. } = mode {
919
+ true
920
+ } else {
921
+ false
922
+ } ;
895
923
assert ! ( !use_snapshot || stage == 0 || self . local_rebuild) ;
896
924
897
925
let maybe_sysroot = self . sysroot ( compiler) ;
@@ -944,8 +972,9 @@ impl<'a> Builder<'a> {
944
972
let debuginfo_level = match mode {
945
973
Mode :: Rustc | Mode :: Codegen => self . config . rust_debuginfo_level_rustc ,
946
974
Mode :: Std => self . config . rust_debuginfo_level_std ,
947
- Mode :: ToolBootstrap | Mode :: ToolStd |
948
- Mode :: ToolRustc => self . config . rust_debuginfo_level_tools ,
975
+ Mode :: ToolBootstrap { .. } | Mode :: ToolStd { .. } | Mode :: ToolRustc { .. } => {
976
+ self . config . rust_debuginfo_level_tools
977
+ }
949
978
} ;
950
979
cargo. env ( "RUSTC_DEBUGINFO_LEVEL" , debuginfo_level. to_string ( ) ) ;
951
980
@@ -1031,10 +1060,6 @@ impl<'a> Builder<'a> {
1031
1060
1032
1061
cargo. env ( "RUSTC_VERBOSE" , self . verbosity . to_string ( ) ) ;
1033
1062
1034
- if self . config . deny_warnings {
1035
- cargo. env ( "RUSTC_DENY_WARNINGS" , "1" ) ;
1036
- }
1037
-
1038
1063
// Throughout the build Cargo can execute a number of build scripts
1039
1064
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
1040
1065
// obtained previously to those build scripts.
0 commit comments