diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 1e687d63f5875..dca873a85d813 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -471,20 +471,26 @@ impl LangString { for token in tokens { match token { "" => {}, - "should_panic" => { data.should_panic = true; seen_rust_tags = true; }, - "no_run" => { data.no_run = true; seen_rust_tags = true; }, - "ignore" => { data.ignore = true; seen_rust_tags = true; }, - "rust" => { data.rust = true; seen_rust_tags = true; }, - "test_harness" => { data.test_harness = true; seen_rust_tags = true; }, + "should_panic" => { + data.should_panic = true; + seen_rust_tags = seen_other_tags == false; + } + "no_run" => { data.no_run = true; seen_rust_tags = seen_other_tags == false; } + "ignore" => { data.ignore = true; seen_rust_tags = seen_other_tags == false; } + "rust" => { data.rust = true; seen_rust_tags = true; } + "test_harness" => { + data.test_harness = true; + seen_rust_tags = seen_other_tags == false || seen_rust_tags == true; + } "compile_fail" if allow_compile_fail => { data.compile_fail = true; - seen_rust_tags = true; + seen_rust_tags = seen_other_tags == false || seen_rust_tags == true; data.no_run = true; } x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => { if let Ok(_) = x[1..].parse::() { data.error_codes.push(x.to_owned()); - seen_rust_tags = true; + seen_rust_tags = seen_other_tags == false || seen_rust_tags == true; } else { seen_other_tags = true; } @@ -670,9 +676,10 @@ mod tests { t("test_harness", false, false, false, true, true, false, Vec::new()); t("compile_fail", false, true, false, true, false, true, Vec::new()); t("{.no_run .example}", false, true, false, true, false, false, Vec::new()); - t("{.sh .should_panic}", true, false, false, true, false, false, Vec::new()); + t("{.sh .should_panic}", true, false, false, false, false, false, Vec::new()); t("{.example .rust}", false, false, false, true, false, false, Vec::new()); t("{.test_harness .rust}", false, false, false, true, true, false, Vec::new()); + t("text, no_run", false, true, false, false, false, false, Vec::new()); } #[test]