Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore doctests only in specified targets #138877

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,11 +1201,12 @@ impl LangString {
seen_rust_tags = !seen_other_tags;
}
LangStringToken::LangToken(x)
if let Some(ignore) = x.strip_prefix("ignore-")
&& enable_per_target_ignores =>
if let Some(ignore) = x.strip_prefix("ignore-") =>
{
ignores.push(ignore.to_owned());
seen_rust_tags = !seen_other_tags;
if enable_per_target_ignores {
ignores.push(ignore.to_owned());
seen_rust_tags = !seen_other_tags;
}
}
LangStringToken::LangToken("rust") => {
data.rust = true;
Expand Down
14 changes: 14 additions & 0 deletions tests/rustdoc-ui/doctest/per-target-ignores.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ only-aarch64
//@ compile-flags:--test
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

///```ignore-x86_64
/// assert!(cfg!(not(target_arch = "x86_64")));
///```
pub fn foo() -> u8 {
4
}

fn main() {}
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/per-target-ignores.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/per-target-ignores.rs - foo (line 7) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Loading