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

rustdoc ignore-* markdown attribute ignores everything #138863

Closed
weihanglo opened this issue Mar 23, 2025 · 5 comments · Fixed by #138877
Closed

rustdoc ignore-* markdown attribute ignores everything #138863

weihanglo opened this issue Mar 23, 2025 · 5 comments · Fixed by #138877
Assignees
Labels
A-doctests Area: Documentation tests, run by rustdoc C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@weihanglo
Copy link
Member

weihanglo commented Mar 23, 2025

Run rustdoc --test lib.rs on aarch64, this doesn't seem to run doctest, while previously it did.

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

Steps

$ rustdoc +nightly-2025-03-23 --test lib.rs

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
$ rustdoc +nightly-2025-03-22 --test lib.rs

running 1 test
test lib.rs - foo (line 2) ... ok

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

Meta

  • Bad version rustdoc 1.87.0-nightly (b48576b4d 2025-03-22)
  • Good version rustdoc 1.87.0-nightly (be73c1f46 2025-03-21)

Possibly caused by #138535.

See also rust-lang/cargo#15193 (comment).

@weihanglo weihanglo added A-doctests Area: Documentation tests, run by rustdoc C-bug Category: This is a bug. labels Mar 23, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 23, 2025
@Urgau Urgau added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Mar 23, 2025
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 23, 2025
@Urgau Urgau added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 23, 2025
@ehuss
Copy link
Contributor

ehuss commented Mar 23, 2025

cc @yotamofek @notriddle

@TaKO8Ki
Copy link
Member

TaKO8Ki commented Mar 23, 2025

As a result of the investigation, it appears that this issue is occurring due to changes in how enable-per-target-ignores is handled in this pull request.

When enable-per-target-ignores is not set, it defaults to false. In the previous implementation, this typically matched the arm below and therefore did not ignore the attributes. However, due to the change in conditions, it no longer matches the same arm. If a fix is necessary, the behavior can be reverted to the original by modifying the implementation of that arm.

LangStringToken::LangToken(x) if x.starts_with("ignore-") => {
if enable_per_target_ignores {

It matches the following arm in current nightly.

LangStringToken::LangToken(x) if let Some(extra) = extra => {

One concern, however, is that the original handling of enable_per_target_ignores might have been incorrect, and the current implementation could be the correct one. Since the option is unstable and its removal is under consideration when it is stabilized, I would like to hear opinions on what kind of implementation would be best for rustdoc.

@yotamofek
Copy link
Contributor

yotamofek commented Mar 23, 2025

Well, oops. 😅
Thanks for the investigation and sorry for the mess.
I'm traveling and won't have access to a computer until Tuesday at the earliest, so won't be able to file a fix before that.

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 24, 2025
…r-doctests, r=<try>

Ignore doctests only in specified targets

Quick fix for rust-lang#138863

cc `@yotamofek` `@notriddle`
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Mar 24, 2025

Here is the quick fix for that if necessary. #138877

@TaKO8Ki TaKO8Ki self-assigned this Mar 24, 2025
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Mar 24, 2025
…for-doctests, r=notriddle

Ignore doctests only in specified targets

Quick fix for rust-lang#138863

FIxes  rust-lang#138863

cc `@yotamofek` `@notriddle`
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Mar 24, 2025
…for-doctests, r=notriddle

Ignore doctests only in specified targets

Quick fix for rust-lang#138863

FIxes  rust-lang#138863

cc ``@yotamofek`` ``@notriddle``
@bors bors closed this as completed in fc8fc05 Mar 26, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 26, 2025
Rollup merge of rust-lang#138877 - TaKO8Ki:enable-per-target-ignores-for-doctests, r=notriddle

Ignore doctests only in specified targets

Quick fix for rust-lang#138863

FIxes  rust-lang#138863

cc `@yotamofek` `@notriddle`
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Mar 26, 2025

@weihanglo @yotamofek @notriddle The quick fix was merged.

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
Development

Successfully merging a pull request may close this issue.

7 participants