@@ -21,7 +21,10 @@ use super::Metadata;
21
21
const USER_AGENT : & str = "docs.rs builder (https://github.com/rust-lang/docs.rs)" ;
22
22
const DEFAULT_RUSTWIDE_WORKSPACE : & str = ".rustwide" ;
23
23
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" ;
25
28
pub ( super ) const TARGETS : & [ & str ] = & [
26
29
"i686-pc-windows-msvc" ,
27
30
"i686-unknown-linux-gnu" ,
@@ -191,7 +194,7 @@ impl RustwideBuilder {
191
194
. run ( |build| {
192
195
let metadata = Metadata :: from_source_dir ( & build. host_source_dir ( ) ) ?;
193
196
194
- let res = self . execute_build ( DEFAULT_TARGET , true , build, & limits, & metadata) ?;
197
+ let res = self . execute_build ( HOST_TARGET , true , build, & limits, & metadata) ?;
195
198
if !res. result . successful {
196
199
bail ! ( "failed to build dummy crate for {}" , self . rustc_version) ;
197
200
}
@@ -447,7 +450,7 @@ impl RustwideBuilder {
447
450
rustdoc_flags. append ( & mut package_rustdoc_args. iter ( ) . map ( |s| s. to_owned ( ) ) . collect ( ) ) ;
448
451
}
449
452
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 {
451
454
cargo_args. push ( "--target" . to_owned ( ) ) ;
452
455
cargo_args. push ( target. to_owned ( ) ) ;
453
456
} ;
@@ -487,7 +490,7 @@ impl RustwideBuilder {
487
490
// cargo will put the output in `target/<target>/doc`.
488
491
// However, if this is the default build, we don't want it there,
489
492
// we want it in `target/doc`.
490
- if target != DEFAULT_TARGET && is_default_target {
493
+ if target != HOST_TARGET && is_default_target {
491
494
// mv target/target/doc target/doc
492
495
let target_dir = build. host_target_dir ( ) ;
493
496
let old_dir = target_dir. join ( target) . join ( "doc" ) ;
0 commit comments