Skip to content

Allow #![doc(test(attr(..)))] everywhere#140560

Merged
bors merged 6 commits intorust-lang:masterfrom
Urgau:test_attr-module-level
Jun 8, 2025
Merged

Allow #![doc(test(attr(..)))] everywhere#140560
bors merged 6 commits intorust-lang:masterfrom
Urgau:test_attr-module-level

Conversation

@Urgau
Copy link
Copy Markdown
Member

@Urgau Urgau commented May 1, 2025

This PR adds the ability to specify #![doc(test(attr(..)))] at module level everywhere in addition to allowing it at crate-root.

This is motivated by a recent PR #140323 (by @tgross35) where we have to duplicate 2 attributes to every single f16 and f128 doctests, by allowing #![doc(test(attr(..)))] at module level (and everywhere else) we can omit them entirely and just have (in both module):

#![doc(test(attr(feature(cfg_target_has_reliable_f16_f128))))]
#![doc(test(attr(expect(internal_features))))]

Those new attributes are appended to the one found at crate-root or at a previous module. Those "global" attributes are compatible with merged doctests (they already were before).

Given the small addition that this is, I'm proposing to insta-stabilize it, but I can feature-gate it if preferred.

Best reviewed commit by commit.

r? @GuillaumeGomez

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-doctests Area: Documentation tests, run by rustdoc A-run-make Area: port run-make Makefiles to rmake.rs disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants