@@ -95,7 +95,7 @@ pub struct RunConfig<'a> {
95
95
pub builder : & ' a Builder < ' a > ,
96
96
pub host : Interned < String > ,
97
97
pub target : Interned < String > ,
98
- pub path : PathBuf ,
98
+ pub path : Option < & ' a Path > ,
99
99
}
100
100
101
101
struct StepDescription {
@@ -105,32 +105,6 @@ struct StepDescription {
105
105
only_build : bool ,
106
106
should_run : fn ( ShouldRun ) -> ShouldRun ,
107
107
make_run : fn ( RunConfig ) ,
108
- name : & ' static str ,
109
- }
110
-
111
- #[ derive( Debug , Clone , PartialOrd , Ord , PartialEq , Eq ) ]
112
- struct PathSet {
113
- set : BTreeSet < PathBuf > ,
114
- }
115
-
116
- impl PathSet {
117
- fn empty ( ) -> PathSet {
118
- PathSet { set : BTreeSet :: new ( ) }
119
- }
120
-
121
- fn one < P : Into < PathBuf > > ( path : P ) -> PathSet {
122
- let mut set = BTreeSet :: new ( ) ;
123
- set. insert ( path. into ( ) ) ;
124
- PathSet { set }
125
- }
126
-
127
- fn has ( & self , needle : & Path ) -> bool {
128
- self . set . iter ( ) . any ( |p| p. ends_with ( needle) )
129
- }
130
-
131
- fn path ( & self , builder : & Builder ) -> PathBuf {
132
- self . set . iter ( ) . next ( ) . unwrap_or ( & builder. build . src ) . to_path_buf ( )
133
- }
134
108
}
135
109
136
110
impl StepDescription {
@@ -142,18 +116,10 @@ impl StepDescription {
142
116
only_build : S :: ONLY_BUILD ,
143
117
should_run : S :: should_run,
144
118
make_run : S :: make_run,
145
- name : unsafe { :: std:: intrinsics:: type_name :: < S > ( ) } ,
146
119
}
147
120
}
148
121
149
- fn maybe_run ( & self , builder : & Builder , pathset : & PathSet ) {
150
- if builder. config . exclude . iter ( ) . any ( |e| pathset. has ( e) ) {
151
- eprintln ! ( "Skipping {:?} because it is excluded" , pathset) ;
152
- return ;
153
- } else if !builder. config . exclude . is_empty ( ) {
154
- eprintln ! ( "{:?} not skipped for {:?} -- not in {:?}" , pathset,
155
- self . name, builder. config. exclude) ;
156
- }
122
+ fn maybe_run ( & self , builder : & Builder , path : Option < & Path > ) {
157
123
let build = builder. build ;
158
124
let hosts = if self . only_build_targets || self . only_build {
159
125
build. build_triple ( )
@@ -178,7 +144,7 @@ impl StepDescription {
178
144
for target in targets {
179
145
let run = RunConfig {
180
146
builder,
181
- path : pathset . path ( builder ) ,
147
+ path,
182
148
host : * host,
183
149
target : * target,
184
150
} ;
@@ -191,28 +157,19 @@ impl StepDescription {
191
157
let should_runs = v. iter ( ) . map ( |desc| {
192
158
( desc. should_run ) ( ShouldRun :: new ( builder) )
193
159
} ) . collect :: < Vec < _ > > ( ) ;
194
-
195
- // sanity checks on rules
196
- for ( desc, should_run) in v. iter ( ) . zip ( & should_runs) {
197
- assert ! ( !should_run. paths. is_empty( ) ,
198
- "{:?} should have at least one pathset" , desc. name) ;
199
- }
200
-
201
160
if paths. is_empty ( ) {
202
161
for ( desc, should_run) in v. iter ( ) . zip ( should_runs) {
203
162
if desc. default && should_run. is_really_default {
204
- for pathset in & should_run. paths {
205
- desc. maybe_run ( builder, pathset) ;
206
- }
163
+ desc. maybe_run ( builder, None ) ;
207
164
}
208
165
}
209
166
} else {
210
167
for path in paths {
211
168
let mut attempted_run = false ;
212
169
for ( desc, should_run) in v. iter ( ) . zip ( & should_runs) {
213
- if let Some ( pathset ) = should_run. pathset_for_path ( path) {
170
+ if should_run. run ( path) {
214
171
attempted_run = true ;
215
- desc. maybe_run ( builder, pathset ) ;
172
+ desc. maybe_run ( builder, Some ( path ) ) ;
216
173
}
217
174
}
218
175
@@ -228,7 +185,7 @@ impl StepDescription {
228
185
pub struct ShouldRun < ' a > {
229
186
pub builder : & ' a Builder < ' a > ,
230
187
// use a BTreeSet to maintain sort order
231
- paths : BTreeSet < PathSet > ,
188
+ paths : BTreeSet < PathBuf > ,
232
189
233
190
// If this is a default rule, this is an additional constraint placed on
234
191
// it's run. Generally something like compiler docs being enabled.
@@ -249,46 +206,25 @@ impl<'a> ShouldRun<'a> {
249
206
self
250
207
}
251
208
252
- // Unlike `krate` this will create just one pathset. As such, it probably shouldn't actually
253
- // ever be used, but as we transition to having all rules properly handle passing krate(...) by
254
- // actually doing something different for every crate passed.
255
- pub fn all_krates ( mut self , name : & str ) -> Self {
256
- let mut set = BTreeSet :: new ( ) ;
257
- for krate in self . builder . in_tree_crates ( name) {
258
- set. insert ( PathBuf :: from ( & krate. path ) ) ;
259
- }
260
- self . paths . insert ( PathSet { set } ) ;
261
- self
262
- }
263
-
264
209
pub fn krate ( mut self , name : & str ) -> Self {
265
- for krate in self . builder . in_tree_crates ( name) {
266
- self . paths . insert ( PathSet :: one ( & krate . path ) ) ;
210
+ for ( _ , krate_path ) in self . builder . crates ( name) {
211
+ self . paths . insert ( PathBuf :: from ( krate_path ) ) ;
267
212
}
268
213
self
269
214
}
270
215
271
- // single, non-aliased path
272
- pub fn path ( self , path : & str ) -> Self {
273
- self . paths ( & [ path] )
274
- }
275
-
276
- // multiple aliases for the same job
277
- pub fn paths ( mut self , paths : & [ & str ] ) -> Self {
278
- self . paths . insert ( PathSet {
279
- set : paths. iter ( ) . map ( PathBuf :: from) . collect ( ) ,
280
- } ) ;
216
+ pub fn path ( mut self , path : & str ) -> Self {
217
+ self . paths . insert ( PathBuf :: from ( path) ) ;
281
218
self
282
219
}
283
220
284
221
// allows being more explicit about why should_run in Step returns the value passed to it
285
- pub fn never ( mut self ) -> ShouldRun < ' a > {
286
- self . paths . insert ( PathSet :: empty ( ) ) ;
222
+ pub fn never ( self ) -> ShouldRun < ' a > {
287
223
self
288
224
}
289
225
290
- fn pathset_for_path ( & self , path : & Path ) -> Option < & PathSet > {
291
- self . paths . iter ( ) . find ( |pathset| pathset . has ( path ) )
226
+ fn run ( & self , path : & Path ) -> bool {
227
+ self . paths . iter ( ) . any ( |p| path . ends_with ( p ) )
292
228
}
293
229
}
294
230
@@ -318,23 +254,19 @@ impl<'a> Builder<'a> {
318
254
tool:: RustInstaller , tool:: Cargo , tool:: Rls , tool:: Rustdoc , tool:: Clippy ,
319
255
native:: Llvm , tool:: Rustfmt , tool:: Miri ) ,
320
256
Kind :: Check => describe ! ( check:: Std , check:: Test , check:: Rustc ) ,
321
- Kind :: Test => describe ! ( test:: Tidy , test:: Bootstrap , test:: Ui , test:: RunPass ,
322
- test:: CompileFail , test:: ParseFail , test:: RunFail , test:: RunPassValgrind ,
323
- test:: MirOpt , test:: Codegen , test:: CodegenUnits , test:: Incremental , test:: Debuginfo ,
324
- test:: UiFullDeps , test:: RunPassFullDeps , test:: RunFailFullDeps ,
325
- test:: CompileFailFullDeps , test:: IncrementalFullDeps , test:: Rustdoc , test:: Pretty ,
326
- test:: RunPassPretty , test:: RunFailPretty , test:: RunPassValgrindPretty ,
327
- test:: RunPassFullDepsPretty , test:: RunFailFullDepsPretty , test:: RunMake ,
328
- test:: Crate , test:: CrateLibrustc , test:: Rustdoc , test:: Linkcheck , test:: Cargotest ,
329
- test:: Cargo , test:: Rls , test:: Docs , test:: ErrorIndex , test:: Distcheck ,
330
- test:: Rustfmt , test:: Miri , test:: Clippy , test:: RustdocJS , test:: RustdocTheme ) ,
257
+ Kind :: Test => describe ! ( test:: Tidy , test:: Bootstrap , test:: DefaultCompiletest ,
258
+ test:: HostCompiletest , test:: Crate , test:: CrateLibrustc , test:: Rustdoc ,
259
+ test:: Linkcheck , test:: Cargotest , test:: Cargo , test:: Rls , test:: Docs ,
260
+ test:: ErrorIndex , test:: Distcheck , test:: Rustfmt , test:: Miri , test:: Clippy ,
261
+ test:: RustdocJS , test:: RustdocTheme ) ,
331
262
Kind :: Bench => describe ! ( test:: Crate , test:: CrateLibrustc ) ,
332
263
Kind :: Doc => describe ! ( doc:: UnstableBook , doc:: UnstableBookGen , doc:: TheBook ,
333
264
doc:: Standalone , doc:: Std , doc:: Test , doc:: Rustc , doc:: ErrorIndex , doc:: Nomicon ,
334
265
doc:: Reference , doc:: Rustdoc , doc:: RustByExample , doc:: CargoBook ) ,
335
266
Kind :: Dist => describe ! ( dist:: Docs , dist:: Mingw , dist:: Rustc , dist:: DebuggerScripts ,
336
267
dist:: Std , dist:: Analysis , dist:: Src , dist:: PlainSourceTarball , dist:: Cargo ,
337
- dist:: Rls , dist:: Rustfmt , dist:: Extended , dist:: HashSign ) ,
268
+ dist:: Rls , dist:: Rustfmt , dist:: Extended , dist:: HashSign ,
269
+ dist:: DontDistWithMiriEnabled ) ,
338
270
Kind :: Install => describe ! ( install:: Docs , install:: Std , install:: Cargo , install:: Rls ,
339
271
install:: Rustfmt , install:: Analysis , install:: Src , install:: Rustc ) ,
340
272
}
@@ -365,10 +297,8 @@ impl<'a> Builder<'a> {
365
297
should_run = ( desc. should_run ) ( should_run) ;
366
298
}
367
299
let mut help = String :: from ( "Available paths:\n " ) ;
368
- for pathset in should_run. paths {
369
- for path in pathset. set {
370
- help. push_str ( format ! ( " ./x.py {} {}\n " , subcommand, path. display( ) ) . as_str ( ) ) ;
371
- }
300
+ for path in should_run. paths {
301
+ help. push_str ( format ! ( " ./x.py {} {}\n " , subcommand, path. display( ) ) . as_str ( ) ) ;
372
302
}
373
303
Some ( help)
374
304
}
@@ -393,12 +323,6 @@ impl<'a> Builder<'a> {
393
323
stack : RefCell :: new ( Vec :: new ( ) ) ,
394
324
} ;
395
325
396
- if kind == Kind :: Dist {
397
- assert ! ( !build. config. test_miri, "Do not distribute with miri enabled.\n \
398
- The distributed libraries would include all MIR (increasing binary size).
399
- The distributed MIR would include validation statements." ) ;
400
- }
401
-
402
326
StepDescription :: run ( & Builder :: get_step_descriptions ( builder. kind ) , & builder, paths) ;
403
327
}
404
328
0 commit comments