@@ -21,13 +21,6 @@ pub struct Std {
2121 ///
2222 /// [`compile::Rustc`]: crate::core::build_steps::compile::Rustc
2323 crates : Vec < String > ,
24- /// Override `Builder::kind` on cargo invocations.
25- ///
26- /// By default, `Builder::kind` is propagated as the subcommand to the cargo invocations.
27- /// However, there are cases when this is not desirable. For example, when running `x clippy $tool_name`,
28- /// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
29- /// which is not useful if we only want to lint a few crates with specific rules.
30- override_build_kind : Option < Kind > ,
3124 /// Never use this from outside calls. It is intended for internal use only within `check::Std::make_run`
3225 /// and `check::Std::run`.
3326 custom_stage : Option < u32 > ,
@@ -37,12 +30,7 @@ impl Std {
3730 const CRATE_OR_DEPS : & [ & str ] = & [ "sysroot" , "coretests" , "alloctests" ] ;
3831
3932 pub fn new ( target : TargetSelection ) -> Self {
40- Self { target, crates : vec ! [ ] , override_build_kind : None , custom_stage : None }
41- }
42-
43- pub fn build_kind ( mut self , kind : Option < Kind > ) -> Self {
44- self . override_build_kind = kind;
45- self
33+ Self { target, crates : vec ! [ ] , custom_stage : None }
4634 }
4735}
4836
@@ -68,12 +56,7 @@ impl Step for Std {
6856 1
6957 } ;
7058
71- run. builder . ensure ( Std {
72- target : run. target ,
73- crates,
74- override_build_kind : None ,
75- custom_stage : Some ( stage) ,
76- } ) ;
59+ run. builder . ensure ( Std { target : run. target , crates, custom_stage : Some ( stage) } ) ;
7760 }
7861
7962 fn run ( self , builder : & Builder < ' _ > ) {
@@ -116,7 +99,7 @@ impl Step for Std {
11699 Mode :: Std ,
117100 SourceType :: InTree ,
118101 target,
119- self . override_build_kind . unwrap_or ( builder . kind ) ,
102+ Kind :: Check ,
120103 ) ;
121104
122105 std_cargo ( builder, target, compiler. stage , & mut cargo) ;
@@ -147,9 +130,8 @@ impl Step for Std {
147130 }
148131 drop ( _guard) ;
149132
150- // don't run on std twice with x.py clippy
151133 // don't check test dependencies if we haven't built libtest
152- if builder . kind == Kind :: Clippy || !self . crates . iter ( ) . any ( |krate| krate == "test" ) {
134+ if !self . crates . iter ( ) . any ( |krate| krate == "test" ) {
153135 return ;
154136 }
155137
@@ -165,7 +147,7 @@ impl Step for Std {
165147 Mode :: Std ,
166148 SourceType :: InTree ,
167149 target,
168- self . override_build_kind . unwrap_or ( builder . kind ) ,
150+ Kind :: Check ,
169151 ) ;
170152
171153 // If we're not in stage 0, tests and examples will fail to compile
@@ -199,13 +181,6 @@ pub struct Rustc {
199181 ///
200182 /// [`compile::Rustc`]: crate::core::build_steps::compile::Rustc
201183 crates : Vec < String > ,
202- /// Override `Builder::kind` on cargo invocations.
203- ///
204- /// By default, `Builder::kind` is propagated as the subcommand to the cargo invocations.
205- /// However, there are cases when this is not desirable. For example, when running `x clippy $tool_name`,
206- /// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
207- /// which is not useful if we only want to lint a few crates with specific rules.
208- override_build_kind : Option < Kind > ,
209184}
210185
211186impl Rustc {
@@ -215,12 +190,7 @@ impl Rustc {
215190 . into_iter ( )
216191 . map ( |krate| krate. name . to_string ( ) )
217192 . collect ( ) ;
218- Self { target, crates, override_build_kind : None }
219- }
220-
221- pub fn build_kind ( mut self , build_kind : Option < Kind > ) -> Self {
222- self . override_build_kind = build_kind;
223- self
193+ Self { target, crates }
224194 }
225195}
226196
@@ -235,7 +205,7 @@ impl Step for Rustc {
235205
236206 fn make_run ( run : RunConfig < ' _ > ) {
237207 let crates = run. make_run_crates ( Alias :: Compiler ) ;
238- run. builder . ensure ( Rustc { target : run. target , crates, override_build_kind : None } ) ;
208+ run. builder . ensure ( Rustc { target : run. target , crates } ) ;
239209 }
240210
241211 /// Builds the compiler.
@@ -256,7 +226,7 @@ impl Step for Rustc {
256226 builder. ensure ( crate :: core:: build_steps:: compile:: Std :: new ( compiler, compiler. host ) ) ;
257227 builder. ensure ( crate :: core:: build_steps:: compile:: Std :: new ( compiler, target) ) ;
258228 } else {
259- builder. ensure ( Std :: new ( target) . build_kind ( self . override_build_kind ) ) ;
229+ builder. ensure ( Std :: new ( target) ) ;
260230 }
261231
262232 let mut cargo = builder:: Cargo :: new (
@@ -265,17 +235,11 @@ impl Step for Rustc {
265235 Mode :: Rustc ,
266236 SourceType :: InTree ,
267237 target,
268- self . override_build_kind . unwrap_or ( builder . kind ) ,
238+ Kind :: Check ,
269239 ) ;
270240
271241 rustc_cargo ( builder, & mut cargo, target, & compiler, & self . crates ) ;
272242
273- // For ./x.py clippy, don't run with --all-targets because
274- // linting tests and benchmarks can produce very noisy results
275- if builder. kind != Kind :: Clippy {
276- cargo. arg ( "--all-targets" ) ;
277- }
278-
279243 // Explicitly pass -p for all compiler crates -- this will force cargo
280244 // to also check the tests/benches/examples for these crates, rather
281245 // than just the leaf crate.
@@ -400,14 +364,9 @@ impl Step for RustAnalyzer {
400364
401365 cargo. allow_features ( crate :: core:: build_steps:: tool:: RustAnalyzer :: ALLOW_FEATURES ) ;
402366
403- // For ./x.py clippy, don't check those targets because
404- // linting tests and benchmarks can produce very noisy results
405- if builder. kind != Kind :: Clippy {
406- // can't use `--all-targets` because `--examples` doesn't work well
407- cargo. arg ( "--bins" ) ;
408- cargo. arg ( "--tests" ) ;
409- cargo. arg ( "--benches" ) ;
410- }
367+ cargo. arg ( "--bins" ) ;
368+ cargo. arg ( "--tests" ) ;
369+ cargo. arg ( "--benches" ) ;
411370
412371 // Cargo's output path in a given stage, compiled by a particular
413372 // compiler for the specified target.
@@ -468,11 +427,7 @@ impl Step for Compiletest {
468427
469428 cargo. allow_features ( COMPILETEST_ALLOW_FEATURES ) ;
470429
471- // For ./x.py clippy, don't run with --all-targets because
472- // linting tests and benchmarks can produce very noisy results
473- if builder. kind != Kind :: Clippy {
474- cargo. arg ( "--all-targets" ) ;
475- }
430+ cargo. arg ( "--all-targets" ) ;
476431
477432 let stamp = BuildStamp :: new ( & builder. cargo_out ( compiler, mode, self . target ) )
478433 . with_prefix ( "compiletest-check" ) ;
@@ -546,11 +501,7 @@ fn run_tool_check_step(
546501 & [ ] ,
547502 ) ;
548503
549- // For ./x.py clippy, don't run with --all-targets because
550- // linting tests and benchmarks can produce very noisy results
551- if builder. kind != Kind :: Clippy {
552- cargo. arg ( "--all-targets" ) ;
553- }
504+ cargo. arg ( "--all-targets" ) ;
554505
555506 let stamp = BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: ToolRustc , target) )
556507 . with_prefix ( & format ! ( "{}-check" , step_type_name. to_lowercase( ) ) ) ;
0 commit comments