From ee3a0f867e938f469cbbb422a76ed5662be2ecc7 Mon Sep 17 00:00:00 2001 From: Seth Pellegrino Date: Mon, 6 Jul 2020 08:46:44 -0700 Subject: [PATCH] Add guard to check for local `core` crate --- src/librustdoc/clean/types.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 34f91bfec5a..d2ba34ccb81 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -649,14 +649,16 @@ pub fn links(&self, krate: &CrateNum) -> Vec<(String, String)> { if let Some(ref fragment) = *fragment { let cache = cache(); let url = match cache.extern_locations.get(krate) { - Some(&(_, _, ExternalLocation::Local)) => { + Some(&(ref krate_name, _, ExternalLocation::Local)) + if krate_name == "core" => + { let depth = CURRENT_DEPTH.with(|l| l.get()); "../".repeat(depth) } Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(), - Some(&(_, _, ExternalLocation::Unknown)) | None => { - String::from("https://doc.rust-lang.org/nightly") - } + Some(&(_, _, ExternalLocation::Local)) + | Some(&(_, _, ExternalLocation::Unknown)) + | None => String::from("https://doc.rust-lang.org/nightly"), }; // This is a primitive so the url is done "by hand". let tail = fragment.find('#').unwrap_or_else(|| fragment.len()); -- 2.44.0