@@ -21,13 +21,6 @@ pub struct Std {
21
21
///
22
22
/// [`compile::Rustc`]: crate::core::build_steps::compile::Rustc
23
23
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 > ,
31
24
/// Never use this from outside calls. It is intended for internal use only within `check::Std::make_run`
32
25
/// and `check::Std::run`.
33
26
custom_stage : Option < u32 > ,
@@ -37,12 +30,7 @@ impl Std {
37
30
const CRATE_OR_DEPS : & [ & str ] = & [ "sysroot" , "coretests" , "alloctests" ] ;
38
31
39
32
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 }
46
34
}
47
35
}
48
36
@@ -68,12 +56,7 @@ impl Step for Std {
68
56
1
69
57
} ;
70
58
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) } ) ;
77
60
}
78
61
79
62
fn run ( self , builder : & Builder < ' _ > ) {
@@ -116,7 +99,7 @@ impl Step for Std {
116
99
Mode :: Std ,
117
100
SourceType :: InTree ,
118
101
target,
119
- self . override_build_kind . unwrap_or ( builder . kind ) ,
102
+ Kind :: Check ,
120
103
) ;
121
104
122
105
std_cargo ( builder, target, compiler. stage , & mut cargo) ;
@@ -147,9 +130,8 @@ impl Step for Std {
147
130
}
148
131
drop ( _guard) ;
149
132
150
- // don't run on std twice with x.py clippy
151
133
// 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" ) {
153
135
return ;
154
136
}
155
137
@@ -165,7 +147,7 @@ impl Step for Std {
165
147
Mode :: Std ,
166
148
SourceType :: InTree ,
167
149
target,
168
- self . override_build_kind . unwrap_or ( builder . kind ) ,
150
+ Kind :: Check ,
169
151
) ;
170
152
171
153
// If we're not in stage 0, tests and examples will fail to compile
@@ -199,13 +181,6 @@ pub struct Rustc {
199
181
///
200
182
/// [`compile::Rustc`]: crate::core::build_steps::compile::Rustc
201
183
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 > ,
209
184
}
210
185
211
186
impl Rustc {
@@ -215,12 +190,7 @@ impl Rustc {
215
190
. into_iter ( )
216
191
. map ( |krate| krate. name . to_string ( ) )
217
192
. 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 }
224
194
}
225
195
}
226
196
@@ -235,7 +205,7 @@ impl Step for Rustc {
235
205
236
206
fn make_run ( run : RunConfig < ' _ > ) {
237
207
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 } ) ;
239
209
}
240
210
241
211
/// Builds the compiler.
@@ -256,7 +226,7 @@ impl Step for Rustc {
256
226
builder. ensure ( crate :: core:: build_steps:: compile:: Std :: new ( compiler, compiler. host ) ) ;
257
227
builder. ensure ( crate :: core:: build_steps:: compile:: Std :: new ( compiler, target) ) ;
258
228
} else {
259
- builder. ensure ( Std :: new ( target) . build_kind ( self . override_build_kind ) ) ;
229
+ builder. ensure ( Std :: new ( target) ) ;
260
230
}
261
231
262
232
let mut cargo = builder:: Cargo :: new (
@@ -265,17 +235,11 @@ impl Step for Rustc {
265
235
Mode :: Rustc ,
266
236
SourceType :: InTree ,
267
237
target,
268
- self . override_build_kind . unwrap_or ( builder . kind ) ,
238
+ Kind :: Check ,
269
239
) ;
270
240
271
241
rustc_cargo ( builder, & mut cargo, target, & compiler, & self . crates ) ;
272
242
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
-
279
243
// Explicitly pass -p for all compiler crates -- this will force cargo
280
244
// to also check the tests/benches/examples for these crates, rather
281
245
// than just the leaf crate.
@@ -400,14 +364,9 @@ impl Step for RustAnalyzer {
400
364
401
365
cargo. allow_features ( crate :: core:: build_steps:: tool:: RustAnalyzer :: ALLOW_FEATURES ) ;
402
366
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" ) ;
411
370
412
371
// Cargo's output path in a given stage, compiled by a particular
413
372
// compiler for the specified target.
@@ -468,11 +427,7 @@ impl Step for Compiletest {
468
427
469
428
cargo. allow_features ( COMPILETEST_ALLOW_FEATURES ) ;
470
429
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" ) ;
476
431
477
432
let stamp = BuildStamp :: new ( & builder. cargo_out ( compiler, mode, self . target ) )
478
433
. with_prefix ( "compiletest-check" ) ;
@@ -546,11 +501,7 @@ fn run_tool_check_step(
546
501
& [ ] ,
547
502
) ;
548
503
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" ) ;
554
505
555
506
let stamp = BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: ToolRustc , target) )
556
507
. with_prefix ( & format ! ( "{}-check" , step_type_name. to_lowercase( ) ) ) ;
0 commit comments