rust/compiler/rustc_passes/src
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
..
liveness compiler: Use size_of from the prelude instead of imported 2025-03-07 13:37:04 -08:00
abi_test.rs Replace infallible name_or_empty methods with fallible name methods. 2025-04-17 09:50:52 +10:00
check_attr.rs Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomez 2025-06-07 22:22:55 +02:00
check_export.rs Overhaul UsePath. 2025-06-03 08:23:21 +10:00
dead.rs Rollup merge of #141740 - nnethercote:hir-ItemKind-field-order, r=fee1-dead 2025-05-31 18:51:48 +02:00
debugger_visualizer.rs Replace infallible name_or_empty methods with fallible name methods. 2025-04-17 09:50:52 +10:00
diagnostic_items.rs Move methods from Map to TyCtxt, part 5. 2025-04-02 10:00:46 +11:00
entry.rs use slice::contains where applicable 2025-03-28 12:21:21 +00:00
errors.rs Move naked fn checks to hir_typeck 2025-05-30 16:08:44 +00:00
hir_id_validator.rs Adjust Map's to_string functionality. 2025-03-12 08:30:03 +11:00
input_stats.rs Avoid over-counting of UsePath in the HIR stats. 2025-05-28 17:02:39 +10:00
lang_items.rs deduplicate more walk_* methods in AST visit 2025-06-06 04:59:26 +00:00
layout_test.rs Replace infallible name_or_empty methods with fallible name methods. 2025-04-17 09:50:52 +10:00
lib.rs Move naked fn checks to hir_typeck 2025-05-30 16:08:44 +00:00
lib_features.rs don't depend on rustc_attr_parsing if rustc_data_structures will do 2025-05-09 23:16:55 +02:00
liveness.rs typeck: catch continues pointing to blocks 2025-05-20 17:45:16 -07:00
loops.rs Move methods from Map to TyCtxt, part 4. 2025-03-12 08:55:37 +11:00
reachable.rs Cleanup CodegenFnAttrFlags 2025-05-24 20:31:37 +02:00
stability.rs Reorder fields in hir::ItemKind variants. 2025-05-30 02:23:20 +10:00
upvars.rs Move methods from Map to TyCtxt, part 2. 2025-02-18 10:17:44 +11:00
weak_lang_items.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00