diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 2748903f2d4756b34b5623ae324f0319f6977345..2edcef203ad2680ad8546d30c84c9e0c9cf47a49 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -886,7 +886,18 @@ pub fn cargo( // things still build right, please do! match mode { Mode::Std => metadata.push_str("std"), - _ => {}, + // When we're building rustc tools, they're built with a search path + // that contains things built during the rustc build. For example, + // bitflags is built during the rustc build, and is a dependency of + // rustdoc as well. We're building rustdoc in a different target + // directory, though, which means that Cargo will rebuild the + // dependency. When we go on to build rustdoc, we'll look for + // bitflags, and find two different copies: one built during the + // rustc step and one that we just built. This isn't always a + // problem, somehow -- not really clear why -- but we know that this + // fixes things. + Mode::ToolRustc => metadata.push_str("tool-rustc"), + _ => {} } cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata);