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