@@ -86,7 +86,7 @@ pub fn build_rules(build: &Build) -> Rules {
86
86
//
87
87
// To handle this we do a bit of dynamic dispatch to see what the dependency
88
88
// is. If we're building a LLVM for the build triple, then we don't actually
89
- // have any dependencies! To do that we return a dependency on the "dummy"
89
+ // have any dependencies! To do that we return a dependency on the `Step::noop()`
90
90
// target which does nothing.
91
91
//
92
92
// If we're build a cross-compiled LLVM, however, we need to assemble the
@@ -104,7 +104,7 @@ pub fn build_rules(build: &Build) -> Rules {
104
104
. host ( true )
105
105
. dep ( move |s| {
106
106
if s. target == build. config . build {
107
- dummy ( s , build )
107
+ Step :: noop ( )
108
108
} else {
109
109
s. target ( & build. config . build )
110
110
}
@@ -115,14 +115,11 @@ pub fn build_rules(build: &Build) -> Rules {
115
115
// going on here. You can check out the API docs below and also see a bunch
116
116
// more examples of rules directly below as well.
117
117
118
- // dummy rule to do nothing, useful when a dep maps to no deps
119
- rules. build ( "dummy" , "path/to/nowhere" ) ;
120
-
121
118
// the compiler with no target libraries ready to go
122
119
rules. build ( "rustc" , "src/rustc" )
123
120
. dep ( move |s| {
124
121
if s. stage == 0 {
125
- dummy ( s , build )
122
+ Step :: noop ( )
126
123
} else {
127
124
s. name ( "librustc" )
128
125
. host ( & build. config . build )
@@ -165,7 +162,7 @@ pub fn build_rules(build: &Build) -> Rules {
165
162
. dep ( move |s| s. name ( "rustc" ) . host ( & build. config . build ) . target ( s. host ) )
166
163
. dep ( move |s| {
167
164
if s. host == build. config . build {
168
- dummy ( s , build )
165
+ Step :: noop ( )
169
166
} else {
170
167
s. host ( & build. config . build )
171
168
}
@@ -183,7 +180,7 @@ pub fn build_rules(build: &Build) -> Rules {
183
180
. dep ( |s| s. name ( "libstd" ) )
184
181
. dep ( move |s| {
185
182
if s. host == build. config . build {
186
- dummy ( s , build )
183
+ Step :: noop ( )
187
184
} else {
188
185
s. host ( & build. config . build )
189
186
}
@@ -203,7 +200,7 @@ pub fn build_rules(build: &Build) -> Rules {
203
200
. dep ( move |s| s. name ( "llvm" ) . host ( & build. config . build ) . stage ( 0 ) )
204
201
. dep ( move |s| {
205
202
if s. host == build. config . build {
206
- dummy ( s , build )
203
+ Step :: noop ( )
207
204
} else {
208
205
s. host ( & build. config . build )
209
206
}
@@ -233,7 +230,7 @@ pub fn build_rules(build: &Build) -> Rules {
233
230
if s. target . contains ( "android" ) {
234
231
s. name ( "android-copy-libs" )
235
232
} else {
236
- dummy ( s , build )
233
+ Step :: noop ( )
237
234
}
238
235
} )
239
236
. default ( true )
@@ -514,12 +511,6 @@ pub fn build_rules(build: &Build) -> Rules {
514
511
515
512
rules. verify ( ) ;
516
513
return rules;
517
-
518
- fn dummy < ' a > ( s : & Step < ' a > , build : & ' a Build ) -> Step < ' a > {
519
- s. name ( "dummy" ) . stage ( 0 )
520
- . target ( & build. config . build )
521
- . host ( & build. config . build )
522
- }
523
514
}
524
515
525
516
#[ derive( PartialEq , Eq , Hash , Clone , Debug ) ]
@@ -543,6 +534,10 @@ struct Step<'a> {
543
534
}
544
535
545
536
impl < ' a > Step < ' a > {
537
+ fn noop ( ) -> Step < ' a > {
538
+ Step { name : "" , stage : 0 , host : "" , target : "" }
539
+ }
540
+
546
541
/// Creates a new step which is the same as this, except has a new name.
547
542
fn name ( & self , name : & ' a str ) -> Step < ' a > {
548
543
Step { name : name, ..* self }
@@ -738,6 +733,9 @@ impl<'a> Rules<'a> {
738
733
if self . rules . contains_key ( & dep. name ) || dep. name . starts_with ( "default:" ) {
739
734
continue
740
735
}
736
+ if dep == Step :: noop ( ) {
737
+ continue
738
+ }
741
739
panic ! ( "\
742
740
743
741
invalid rule dependency graph detected, was a rule added and maybe typo'd?
@@ -864,6 +862,7 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
864
862
// of what we need to do.
865
863
let mut order = Vec :: new ( ) ;
866
864
let mut added = HashSet :: new ( ) ;
865
+ added. insert ( Step :: noop ( ) ) ;
867
866
for step in steps. iter ( ) . cloned ( ) {
868
867
self . fill ( step, & mut order, & mut added) ;
869
868
}
0 commit comments