Rollup merge of #138877 - TaKO8Ki:enable-per-target-ignores-for-doctests, r=notriddle

Ignore doctests only in specified targets

Quick fix for #138863

FIxes  #138863

cc `@yotamofek` `@notriddle`
This commit is contained in:
Jacob Pratt 2025-03-25 20:34:48 -04:00 committed by GitHub
commit fc8fc051b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 4 deletions

View File

@ -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;

View File

@ -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() {}

View File

@ -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