Skip to content

Commit eb4440c

Browse files
committed
Allow adding targets at runtime
1 parent e30c54b commit eb4440c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/docbuilder/rustwide_builder.rs

+8
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ impl RustwideBuilder {
130130
//
131131
// Removing it beforehand works fine, and prevents rustup from blocking the update later in
132132
// 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.
133136
for target in installed_targets {
134137
if !targets_to_install.remove(&target) {
135138
self.toolchain.remove_target(&self.workspace, &target)?;
@@ -453,6 +456,11 @@ impl RustwideBuilder {
453456
}
454457
let mut cargo_args = vec!["doc".to_owned(), "--lib".to_owned(), "--no-deps".to_owned()];
455458
if target != HOST_TARGET {
459+
// If the explicit target is not a tier one target, we need to install it.
460+
if !TARGETS.contains(&target) {
461+
// This is a no-op if the target is already installed.
462+
self.toolchain.add_target(&self.workspace, target)?;
463+
}
456464
cargo_args.push("--target".to_owned());
457465
cargo_args.push(target.to_owned());
458466
};

0 commit comments

Comments
 (0)