@@ -21,7 +21,10 @@ use super::Metadata;
2121const USER_AGENT : & str = "docs.rs builder (https://github.com/rust-lang/docs.rs)" ;
2222const DEFAULT_RUSTWIDE_WORKSPACE : & str = ".rustwide" ;
2323
24- pub ( super ) const DEFAULT_TARGET : & str = "x86_64-unknown-linux-gnu" ;
24+ // It is crucial that this be the same as the host that `docs.rs` is being run on.
25+ // Other values may cause strange and hard-to-debug errors.
26+ // TODO: use `TARGET` instead? I think `TARGET` is only set for build scripts, though.
27+ pub ( super ) const HOST_TARGET : & str = "x86_64-unknown-linux-gnu" ;
2528pub ( super ) const TARGETS : & [ & str ] = & [
2629 "i686-pc-windows-msvc" ,
2730 "i686-unknown-linux-gnu" ,
@@ -191,7 +194,7 @@ impl RustwideBuilder {
191194 . run ( |build| {
192195 let metadata = Metadata :: from_source_dir ( & build. host_source_dir ( ) ) ?;
193196
194- let res = self . execute_build ( DEFAULT_TARGET , true , build, & limits, & metadata) ?;
197+ let res = self . execute_build ( HOST_TARGET , true , build, & limits, & metadata) ?;
195198 if !res. result . successful {
196199 bail ! ( "failed to build dummy crate for {}" , self . rustc_version) ;
197200 }
@@ -447,7 +450,7 @@ impl RustwideBuilder {
447450 rustdoc_flags. append ( & mut package_rustdoc_args. iter ( ) . map ( |s| s. to_owned ( ) ) . collect ( ) ) ;
448451 }
449452 let mut cargo_args = vec ! [ "doc" . to_owned( ) , "--lib" . to_owned( ) , "--no-deps" . to_owned( ) ] ;
450- if target != DEFAULT_TARGET {
453+ if target != HOST_TARGET {
451454 cargo_args. push ( "--target" . to_owned ( ) ) ;
452455 cargo_args. push ( target. to_owned ( ) ) ;
453456 } ;
@@ -487,7 +490,7 @@ impl RustwideBuilder {
487490 // cargo will put the output in `target/<target>/doc`.
488491 // However, if this is the default build, we don't want it there,
489492 // we want it in `target/doc`.
490- if target != DEFAULT_TARGET && is_default_target {
493+ if target != HOST_TARGET && is_default_target {
491494 // mv target/target/doc target/doc
492495 let target_dir = build. host_target_dir ( ) ;
493496 let old_dir = target_dir. join ( target) . join ( "doc" ) ;
0 commit comments