Skip to content

[rustdoc] Do not take doc(cfg()) into account when filtering doctests - #159014

Open
GuillaumeGomez wants to merge 5 commits into
rust-lang:mainfrom
GuillaumeGomez:doc-cfg-filter-doctest
Open

[rustdoc] Do not take doc(cfg()) into account when filtering doctests#159014
GuillaumeGomez wants to merge 5 commits into
rust-lang:mainfrom
GuillaumeGomez:doc-cfg-filter-doctest

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Jul 9, 2026

Copy link
Copy Markdown
Member

View all comments

Part of #147033.

Because it was using the extract_cfg_from_attrs common function, it was taking into account the doc(cfg()) attributes the same as if they were a cfg.

I didn't mark this PR as "fix" because I didn't handle the case of the doctest not being marked as ignored because I'm not sure if we should revisit the fact that we ignore these doctests or if we should just mark them as ignored (because of target_feature(enable = "...")).

Setting @fmease as reviewer as they are likely the only one with context about this issue. 😆

r? @fmease

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 9, 2026
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

And now it fails because we (doc) inlined some functions. Fixing that then. :)

@rustbot rustbot added O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows labels Jul 9, 2026
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from f5059c8 to 062cfea Compare July 9, 2026 14:58
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from 062cfea to 1d5692c Compare July 9, 2026 15:43
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Fixed CI \o/

Comment thread src/librustdoc/clean/cfg.rs
@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from 1d5692c to a0bf3c9 Compare July 15, 2026 13:10
@rustbot

This comment has been minimized.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Reverted changes I made to extract_cfg_from_attrs and instead only look for the target_feature attributes.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Ah, new stuff gets added.

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from a0bf3c9 to 59a72c3 Compare July 15, 2026 14:50
@rustbot

rustbot commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

stdarch is developed in its own repository. If possible, consider making this change to rust-lang/stdarch instead.

cc @Amanieu, @folkertdev, @sayantn

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from 59a72c3 to 885af7e Compare July 15, 2026 15:53
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from 885af7e to 21e8051 Compare July 15, 2026 20:35
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Seems like CI is happy now.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Setting a new reviewer as fmease seems busy.

r? @Urgau

@rustbot rustbot assigned Urgau and unassigned fmease Jul 24, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
[rustdoc] Do not take `doc(cfg())` into account when filtering doctests


try-job: x86_64-msvc-1
try-job: pr-check-2
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from c154b1e to c3f66e2 Compare August 3, 2026 22:24
@rustbot rustbot added O-hermit Operating System: Hermit O-linux Operating system: Linux O-netbsd Operating system: NetBSD O-redox Operating system: Redox, https://www.redox-os.org/ O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like labels Aug 3, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@bors try jobs=x86_64-msvc-1,pr-check-2

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
[rustdoc] Do not take `doc(cfg())` into account when filtering doctests


try-job: x86_64-msvc-1
try-job: pr-check-2
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 38cc34c failed: CI. Failed job:

@GuillaumeGomez
GuillaumeGomez force-pushed the doc-cfg-filter-doctest branch from c3f66e2 to 691f045 Compare August 4, 2026 09:25
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@bors try jobs=x86_64-msvc-1,pr-check-2

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 4, 2026
[rustdoc] Do not take `doc(cfg())` into account when filtering doctests


try-job: x86_64-msvc-1
try-job: pr-check-2
@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 0b93ad1 (0b93ad14e8dff09d8753a8305b727d26a03648c0)
Base parent: c9ff496 (c9ff496891c278ad660bc0ab85c1f0b72059464a)

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Ah finally.

@bors r=Urgau

@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 691f045 has been approved by Urgau

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

Reason for tree closure: manually handling queue due to backlog

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 4, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 4, 2026
…est, r=Urgau

[rustdoc] Do not take `doc(cfg())` into account when filtering doctests

Part of rust-lang#147033.

Because it was using the `extract_cfg_from_attrs` common function, it was taking into account the `doc(cfg())` attributes the same as if they were a `cfg`.

I didn't mark this PR as "fix" because I didn't handle the case of the doctest not being marked as ignored because I'm not sure if we should revisit the fact that we ignore these doctests or if we should just mark them as ignored (because of `target_feature(enable = "...")`).

Setting @fmease as reviewer as they are likely the only one with context about this issue. 😆

r? @fmease
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs O-hermit Operating System: Hermit O-linux Operating system: Linux O-netbsd Operating system: NetBSD O-redox Operating system: Redox, https://www.redox-os.org/ O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants