rust/src/doc
Guillaume Gomez 2c8a9cccd9
Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomez
Allow `#![doc(test(attr(..)))]` everywhere

This PR adds the ability to specify [`#![doc(test(attr(..)))]`](https://doc.rust-lang.org/nightly/rustdoc/write-documentation/the-doc-attribute.html#testattr) ~~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):

```rust
#![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````
2025-06-07 22:22:55 +02:00
..
book@634724ea85 Update books 2025-06-02 19:01:18 +02:00
edition-guide@aa6ce337c0 Update books 2025-05-21 01:50:12 +02:00
embedded-book@10fa1e0843 Update books 2025-06-02 19:01:18 +02:00
man Update rustc man page to match rustc --help 2022-08-01 22:03:18 +00:00
nomicon@8b61acfaea Update books 2025-06-02 19:01:18 +02:00
reference@8e0f593a30 Update books 2025-06-02 19:01:18 +02:00
rust-by-example@21f4e32b8b Update books 2025-06-02 19:01:18 +02:00
rustc Rollup merge of #142017 - Rageking8:fix-incorrect-use-of-recommend-over-recommended, r=lqd 2025-06-04 19:50:26 +02:00
rustc-dev-guide Rollup merge of #141970 - onur-ozkan:skip-stage1-std, r=Kobzol 2025-06-05 12:21:34 +02:00
rustdoc Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomez 2025-06-07 22:22:55 +02:00
style-guide style: Never break within a nullary function call func() or a unit literal () 2025-05-07 20:36:06 +01:00
unstable-book Optionally don't steal the THIR 2025-06-01 19:14:13 +02:00
complement-design-faq.md
complement-lang-faq.md
complement-project-faq.md
favicon.inc doc: no shortcut in rel="icon" 2022-01-28 13:42:48 +01:00
footer.inc avoid reuse tripping over copyright notices 2023-03-09 12:24:43 +01:00
full-toc.inc
grammar.md Remove legacy grammar 2019-09-30 07:46:10 +02:00
guide-crates.md
guide-error-handling.md
guide-ffi.md
guide-macros.md
guide-ownership.md
guide-plugins.md Remove support for compiler plugins. 2023-11-04 08:50:46 +11:00
guide-pointers.md
guide-strings.md
guide-tasks.md
guide-testing.md
guide-unsafe.md
guide.md
index.md doc: add release notes to standalone doc bundle 2023-11-13 16:00:31 -07:00
intro.md
not_found.md rustdoc: consistentify #TOC and #ModNav to lowercase 2024-08-20 16:51:40 -07:00
redirect.inc doc: no shortcut in rel="icon" 2022-01-28 13:42:48 +01:00
reference.md Update reference.md 2021-07-10 19:51:36 +02:00
robots.txt Block version-specific docs from search engines 2020-03-14 02:29:35 +00:00
rust.css Fix heading anchors in doc pages. 2024-03-18 09:13:18 -07:00
rust.md
rustdoc.md
tutorial.md
version_info.html.template