Hopefully fix rustdoc build
authorMark Rousskov <mark.simulacrum@gmail.com>
Tue, 5 Nov 2019 16:16:46 +0000 (11:16 -0500)
committerXimin Luo <infinity0@debian.org>
Mon, 23 Dec 2019 03:21:02 +0000 (03:21 +0000)
It's super unclear why this broke when we switched to beta but not
previously -- but at least it's hopefully fixed now.

Gbp-Pq: Name u-0001-Hopefully-fix-rustdoc-build.patch

src/bootstrap/builder.rs

index 5d586f0c461dbd722c1d3d9aec881049c2a5b0d5..bad92d77385b1995520dec5cc32438898a67b9f9 100644 (file)
@@ -875,7 +875,18 @@ impl<'a> Builder<'a> {
         // 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);