Skip to content

Commit 570d072

Browse files
committed
---
yaml --- r: 273726 b: refs/heads/beta c: 8779e7b h: refs/heads/master
1 parent ad28cfc commit 570d072

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 6a76872d7165f901e3ec127a25be1a6303d137b3
26+
refs/heads/beta: 8779e7baa495b8dc46008c8f7d2badcb0ea3b1ab
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustdoc/html/markdown.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,15 @@ mod tests {
607607
fn issue_17736() {
608608
let markdown = "# title";
609609
format!("{}", Markdown(markdown));
610-
reset_ids();
610+
reset_ids(true);
611611
}
612612

613613
#[test]
614614
fn test_header() {
615615
fn t(input: &str, expect: &str) {
616616
let output = format!("{}", Markdown(input));
617617
assert_eq!(output, expect);
618-
reset_ids();
618+
reset_ids(true);
619619
}
620620

621621
t("# Foo bar", "\n<h1 id='foo-bar' class='section-header'>\
@@ -654,7 +654,7 @@ mod tests {
654654
<a href='#panics-1'>Panics</a></h1>");
655655
};
656656
test();
657-
reset_ids();
657+
reset_ids(true);
658658
test();
659659
}
660660

branches/beta/src/librustdoc/html/render.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,14 @@ fn init_ids() -> HashMap<String, usize> {
378378
/// This method resets the local table of used ID attributes. This is typically
379379
/// used at the beginning of rendering an entire HTML page to reset from the
380380
/// previous state (if any).
381-
pub fn reset_ids() {
382-
USED_ID_MAP.with(|s| *s.borrow_mut() = init_ids());
381+
pub fn reset_ids(embedded: bool) {
382+
USED_ID_MAP.with(|s| {
383+
*s.borrow_mut() = if embedded {
384+
init_ids()
385+
} else {
386+
HashMap::new()
387+
};
388+
});
383389
}
384390

385391
pub fn derive_id(candidate: String) -> String {
@@ -1280,7 +1286,7 @@ impl Context {
12801286
keywords: &keywords,
12811287
};
12821288

1283-
reset_ids();
1289+
reset_ids(true);
12841290

12851291
// We have a huge number of calls to write, so try to alleviate some
12861292
// of the pain by using a buffered writer instead of invoking the
@@ -2748,6 +2754,6 @@ fn test_unique_id() {
27482754
assert_eq!(&actual[..], expected);
27492755
};
27502756
test();
2751-
reset_ids();
2757+
reset_ids(true);
27522758
test();
27532759
}

branches/beta/src/librustdoc/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
8383
}
8484
let title = metadata[0];
8585

86-
reset_ids();
86+
reset_ids(false);
8787

8888
let rendered = if include_toc {
8989
format!("{}", MarkdownWithToc(text))

0 commit comments

Comments
 (0)