about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSeth Pellegrino <seth@codecopse.net>2020-07-06 08:46:44 -0700
committerSeth Pellegrino <seth@codecopse.net>2020-07-06 08:46:44 -0700
commitee3a0f867e938f469cbbb422a76ed5662be2ecc7 (patch)
tree203c92bf168253f9c9a4c562e11e880918d97470
parent81fbfc40594e0c74aa46bbf50225c4d923f1464b (diff)
downloadrust-ee3a0f867e938f469cbbb422a76ed5662be2ecc7.tar.gz
rust-ee3a0f867e938f469cbbb422a76ed5662be2ecc7.zip
Add guard to check for local `core` crate
-rw-r--r--src/librustdoc/clean/types.rs10
1 files 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 @@ impl Attributes {
                         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());