Skip to content

Commit 835ba57

Browse files
committed
Auto merge of rust-lang#138877 - TaKO8Ki:enable-per-target-ignores-for-doctests, r=<try>
Ignore doctests only in specified targets Quick fix for rust-lang#138863 cc `@yotamofek` `@notriddle`
2 parents ae8ab87 + 3dae3fb commit 835ba57

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/librustdoc/html/markdown.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1201,11 +1201,12 @@ impl LangString {
12011201
seen_rust_tags = !seen_other_tags;
12021202
}
12031203
LangStringToken::LangToken(x)
1204-
if let Some(ignore) = x.strip_prefix("ignore-")
1205-
&& enable_per_target_ignores =>
1204+
if let Some(ignore) = x.strip_prefix("ignore-") =>
12061205
{
1207-
ignores.push(ignore.to_owned());
1208-
seen_rust_tags = !seen_other_tags;
1206+
if enable_per_target_ignores {
1207+
ignores.push(ignore.to_owned());
1208+
seen_rust_tags = !seen_other_tags;
1209+
}
12091210
}
12101211
LangStringToken::LangToken("rust") => {
12111212
data.rust = true;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ only-aarch64
2+
//@ compile-flags:--test
3+
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
4+
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
5+
//@ check-pass
6+
7+
///```ignore-x86_64
8+
/// assert!(cfg!(not(target_arch = "x86_64")));
9+
///```
10+
pub fn foo() -> u8 {
11+
4
12+
}
13+
14+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
running 1 test
3+
test $DIR/per-target-ignores.rs - foo (line 6) ... ok
4+
5+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6+

0 commit comments

Comments
 (0)