Skip to content

Commit

Permalink
Add guard to check for local core crate
Browse files Browse the repository at this point in the history
  • Loading branch information
sethp committed Jul 6, 2020
1 parent 81fbfc4 commit ee3a0f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ee3a0f8

Please sign in to comment.