@@ -130,6 +130,9 @@ impl RustwideBuilder {
130
130
//
131
131
// Removing it beforehand works fine, and prevents rustup from blocking the update later in
132
132
// the method.
133
+ //
134
+ // Note that this means that non tier-one targets will be uninstalled on every update,
135
+ // and will not be reinstalled until explicitly requested by a crate.
133
136
for target in installed_targets {
134
137
if !targets_to_install. remove ( & target) {
135
138
self . toolchain . remove_target ( & self . workspace , & target) ?;
@@ -351,7 +354,8 @@ impl RustwideBuilder {
351
354
successful_targets. push ( res. target . clone ( ) ) ;
352
355
353
356
// Then build the documentation for all the targets
354
- for target in other_targets {
357
+ // Limit the number of targets so that no one can try to build all 200000 possible targets
358
+ for target in other_targets. into_iter ( ) . take ( limits. targets ( ) ) {
355
359
debug ! ( "building package {} {} for {}" , name, version, target) ;
356
360
self . build_target (
357
361
target,
@@ -453,6 +457,11 @@ impl RustwideBuilder {
453
457
}
454
458
let mut cargo_args = vec ! [ "doc" . to_owned( ) , "--lib" . to_owned( ) , "--no-deps" . to_owned( ) ] ;
455
459
if target != HOST_TARGET {
460
+ // If the explicit target is not a tier one target, we need to install it.
461
+ if !TARGETS . contains ( & target) {
462
+ // This is a no-op if the target is already installed.
463
+ self . toolchain . add_target ( & self . workspace , target) ?;
464
+ }
456
465
cargo_args. push ( "--target" . to_owned ( ) ) ;
457
466
cargo_args. push ( target. to_owned ( ) ) ;
458
467
} ;
0 commit comments