cbcbe2
From 73369f32621f6a844a80a8513ae3ded901e4a406 Mon Sep 17 00:00:00 2001
cbcbe2
From: Mark Rousskov <mark.simulacrum@gmail.com>
cbcbe2
Date: Tue, 5 Nov 2019 11:16:46 -0500
cbcbe2
Subject: [PATCH] Hopefully fix rustdoc build
cbcbe2
cbcbe2
It's super unclear why this broke when we switched to beta but not
cbcbe2
previously -- but at least it's hopefully fixed now.
cbcbe2
---
cbcbe2
 src/bootstrap/builder.rs | 13 ++++++++++++-
cbcbe2
 1 file changed, 12 insertions(+), 1 deletion(-)
cbcbe2
cbcbe2
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
cbcbe2
index 2748903f2d47..2edcef203ad2 100644
cbcbe2
--- a/src/bootstrap/builder.rs
cbcbe2
+++ b/src/bootstrap/builder.rs
cbcbe2
@@ -886,7 +886,18 @@ impl<'a> Builder<'a> {
cbcbe2
         // things still build right, please do!
cbcbe2
         match mode {
cbcbe2
             Mode::Std => metadata.push_str("std"),
cbcbe2
-            _ => {},
cbcbe2
+            // When we're building rustc tools, they're built with a search path
cbcbe2
+            // that contains things built during the rustc build. For example,
cbcbe2
+            // bitflags is built during the rustc build, and is a dependency of
cbcbe2
+            // rustdoc as well. We're building rustdoc in a different target
cbcbe2
+            // directory, though, which means that Cargo will rebuild the
cbcbe2
+            // dependency. When we go on to build rustdoc, we'll look for
cbcbe2
+            // bitflags, and find two different copies: one built during the
cbcbe2
+            // rustc step and one that we just built. This isn't always a
cbcbe2
+            // problem, somehow -- not really clear why -- but we know that this
cbcbe2
+            // fixes things.
cbcbe2
+            Mode::ToolRustc => metadata.push_str("tool-rustc"),
cbcbe2
+            _ => {}
cbcbe2
         }
cbcbe2
         cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata);
cbcbe2
 
cbcbe2
-- 
cbcbe2
2.23.0
cbcbe2