diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-23 19:41:24 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-25 01:18:11 -0700 |
| commit | 837d4d8f35d8db10c9899b35e54f4670ba0cd609 (patch) | |
| tree | 6ad680b1b10153463551a2051cb72ef9107d0778 | |
| parent | a96067077a7536f80e131deaf3355c30ba8f3bff (diff) | |
| download | rust-837d4d8f35d8db10c9899b35e54f4670ba0cd609.tar.gz rust-837d4d8f35d8db10c9899b35e54f4670ba0cd609.zip | |
rustdoc: Link to local reexportations of items
Within the documentation for a crate, all hyperlinks to reexported items don't go across crates, but rather to the items in the crate itself. This will allow references to Option in the standard library to link to the standard library's Option, instead of libcore's. This does mean that other crate's links for Option will still link to libcore's Option.
| -rw-r--r-- | src/librustdoc/html/format.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index e14be8ac6fd..d60fe3c0388 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -150,7 +150,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path, print_all: bool) -> fmt::Result { path(w, p, print_all, |cache, loc| { - if ast_util::is_local(did) { + if ast_util::is_local(did) || cache.paths.contains_key(&did) { Some(("../".repeat(loc.len())).to_strbuf()) } else { match *cache.extern_locations.get(&did.krate) { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 93bd5249a2f..6d6736eac3f 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -797,6 +797,7 @@ impl DocFolder for Cache { // not a public item. let id = item.def_id.node; if !self.paths.contains_key(&item.def_id) || + !ast_util::is_local(item.def_id) || self.public_items.contains(&id) { self.paths.insert(item.def_id, (self.stack.clone(), shortty(&item))); |
