@@ -13,6 +13,7 @@ use std::env;
13
13
use std:: iter;
14
14
use std:: path:: PathBuf ;
15
15
use std:: process:: { Command , exit} ;
16
+ use std:: collections:: HashSet ;
16
17
17
18
use Mode ;
18
19
use Compiler ;
@@ -122,8 +123,13 @@ impl Step for ToolBuild {
122
123
let mut duplicates = Vec :: new ( ) ;
123
124
let is_expected = compile:: stream_cargo ( builder, & mut cargo, & mut |msg| {
124
125
// Only care about big things like the RLS/Cargo for now
125
- if tool != "rls" && tool != "cargo" && tool != "clippy-driver" {
126
- return
126
+ match tool {
127
+ | "rls"
128
+ | "cargo"
129
+ | "clippy-driver"
130
+ => { }
131
+
132
+ _ => return ,
127
133
}
128
134
let ( id, features, filenames) = match msg {
129
135
compile:: CargoMessage :: CompilerArtifact {
@@ -182,12 +188,22 @@ impl Step for ToolBuild {
182
188
typically means that something was recompiled because \
183
189
a transitive dependency has different features activated \
184
190
than in a previous build:\n ") ;
191
+ println ! ( "the following dependencies are duplicated although they \
192
+ have the same features enabled:") ;
193
+ for ( id, cur, prev) in duplicates. drain_filter ( |( _, cur, prev) | cur. 2 == prev. 2 ) {
194
+ println ! ( " {}" , id) ;
195
+ // same features
196
+ println ! ( " `{}` ({:?})\n `{}` ({:?})" , cur. 0 , cur. 1 , prev. 0 , prev. 1 ) ;
197
+ }
198
+ println ! ( "the following dependencies have different features:" ) ;
185
199
for ( id, cur, prev) in duplicates {
186
200
println ! ( " {}" , id) ;
187
- println ! ( " `{}` enabled features {:?} at {:?}" ,
188
- cur. 0 , cur. 2 , cur. 1 ) ;
189
- println ! ( " `{}` enabled features {:?} at {:?}" ,
190
- prev. 0 , prev. 2 , prev. 1 ) ;
201
+ let cur_features: HashSet < _ > = cur. 2 . into_iter ( ) . collect ( ) ;
202
+ let prev_features: HashSet < _ > = prev. 2 . into_iter ( ) . collect ( ) ;
203
+ println ! ( " `{}` additionally enabled features {:?} at {:?}" ,
204
+ cur. 0 , & cur_features - & prev_features, cur. 1 ) ;
205
+ println ! ( " `{}` additionally enabled features {:?} at {:?}" ,
206
+ prev. 0 , & prev_features - & cur_features, prev. 1 ) ;
191
207
}
192
208
println ! ( "" ) ;
193
209
panic ! ( "tools should not compile multiple copies of the same crate" ) ;
0 commit comments