Skip to content

Commit cf844ab

Browse files
committed
rustdoc: Don't treat "super" specially for urls
This was just incorrectly handled before, the path component shouldn't be looked at at all (we used absolute paths everywhere instead of relative to the current module location). Closes #9861
1 parent d773a02 commit cf844ab

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/librustdoc/html/format.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,7 @@ impl fmt::Default for clean::Path {
115115
fn resolved_path(w: &mut io::Writer, id: ast::NodeId, p: &clean::Path,
116116
print_all: bool) {
117117
path(w, p, print_all,
118-
|_cache, loc| {
119-
match p.segments[0].name.as_slice() {
120-
"super" => Some("../".repeat(loc.len() - 1)),
121-
_ => Some("../".repeat(loc.len())),
122-
}
123-
},
118+
|_cache, loc| { Some("../".repeat(loc.len())) },
124119
|cache| {
125120
match cache.paths.find(&id) {
126121
None => None,

src/librustdoc/html/render.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use std::rt::io::file::{FileInfo, DirectoryInfo};
4444
use std::rt::io::file;
4545
use std::rt::io;
4646
use std::rt::io::Reader;
47+
use std::os;
4748
use std::str;
4849
use std::task;
4950
use std::unstable::finally::Finally;
@@ -686,7 +687,15 @@ impl Context {
686687
Process(Context, clean::Item),
687688
}
688689
enum Progress { JobNew, JobDone }
689-
static WORKERS: int = 10;
690+
691+
let workers = match os::getenv("RUSTDOC_WORKERS") {
692+
Some(s) => {
693+
match from_str::<uint>(s) {
694+
Some(n) => n, None => fail2!("{} not a number", s)
695+
}
696+
}
697+
None => 10,
698+
};
690699

691700
let mut item = match crate.module.take() {
692701
Some(i) => i,
@@ -706,7 +715,7 @@ impl Context {
706715
// using the same channel/port. Through this, the crate is recursed on
707716
// in a hierarchical fashion, and parallelization is only achieved if
708717
// one node in the hierarchy has more than one child (very common).
709-
for i in range(0, WORKERS) {
718+
for i in range(0, workers) {
710719
let port = port.clone();
711720
let chan = chan.clone();
712721
let prog_chan = prog_chan.clone();
@@ -761,7 +770,7 @@ impl Context {
761770
if jobs == 0 { break }
762771
}
763772

764-
for _ in range(0, WORKERS) {
773+
for _ in range(0, workers) {
765774
chan.send(Die);
766775
}
767776
}

0 commit comments

Comments
 (0)