Commit Graph

15 Commits

Author SHA1 Message Date
Guillaume Gomez
6cccea8731 Remove doc_auto_cfg feature as well 2025-09-27 11:30:57 +02:00
Guillaume Gomez
c06a076634 Put back the doc_cfg code behind a nightly feature 2025-09-27 11:29:49 +02:00
Matthias Krüger
a39d5134cd Rollup merge of #116882 - fmease:rustdoc-generalized-priv-repr-heuristic, r=rustdoc
rustdoc: hide `#[repr]` if it isn't part of the public ABI

> [!IMPORTANT]
> Temporarily stacked on top of PR https://github.com/rust-lang/rust/pull/146527; only the last commit is relevant!

Follow-up to rust-lang/rust#115439.
Unblocks rust-lang/rust#116743, CC ``@dtolnay.``

Fixes rust-lang/rust#66401.
Fixes rust-lang/rust#128364.
Fixes rust-lang/rust#137440.

Only display the representation `#[repr(REPR)]` (where `REPR` is not `Rust` or `transparent`) of a given type if none of its variants (incl. the synthetic variants of structs) are `#[doc(hidden)]` and all of its fields are public and not `#[doc(hidden)]` since it's likely not meant to be considered part of the public ABI otherwise.

`--document-{private,hidden}-items` works as expected in this context, too.

Moreover, we now also factor in the presence of `#[doc(hidden)]` when checking whether to show `repr(transparent)` or not.
2025-09-25 18:15:06 +02:00
León Orell Valerian Liehr
d7d7725b8c rustdoc: Fully escape link section and export name
Escape "special characters" (e.g., double quotes `"` and line breaks `\n`).
Escape HTML.

Lastly, add regression tests and clean up existing tests.
2025-09-25 11:30:58 +02:00
Iris Shi
bd98e73fe0 Update tests/rustdoc/reexport/private-mod-override-reexport.rs 2025-09-22 17:45:51 +02:00
Iris Shi
52e6998a18 Move test file 2025-09-22 11:47:12 +08:00
Samuel Tardieu
4eddebd42b Rollup merge of #143662 - obi1kenobi:pg/unsafe-attribute-wrappers, r=t-rustdoc
[rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.

Use Rust 2024 edition representation for unsafe attributes in rustdoc HTML:
- `#[no_mangle]` -> `#[unsafe(no_mangle)]`
- `#[export_name = "foo"]` -> `#[unsafe(export_name = "foo")]`
- `#[link_section = ".text"]` -> `#[unsafe(link_section = ".text")]`

The 2024 edition representation is used regardless of the crate's own edition. This ensures that Rustaceans don't have to learn the rules of an outdated edition (e.g. that `unsafe()` wasn't always necessary) in order to understand a crate's documentation.

After some looking through the `T-rustdoc` issues, I was not able to find an existing issue for this. Apologies if I missed it.

r? ``````@aDotInTheVoid``````
2025-08-02 11:24:21 +02:00
Predrag Gruevski
45231fa599 [rustdoc] Display unsafe attrs with edition 2024 unsafe() wrappers. 2025-07-23 00:00:01 +00:00
binarycat
94700f8f3f fix regression test 2025-07-22 17:11:48 -05:00
binarycat
293f95fb0c add regression test for RUST-143222 2025-07-22 17:11:48 -05:00
Jonathan Brouwer
9f16db6611 Regression test 2025-07-17 08:03:17 +02:00
Guillaume Gomez
086b13d170 Add regression test for #143107 2025-07-10 11:41:50 +02:00
binarycat
f7321becd2 rustdoc: add regression test for issue 135092 2025-06-27 11:49:12 -05:00
David Wood
da47753496 rustdoc: {Meta,Pointee,}Sized in non-minicore
Some rustdoc tests are `no_core` and need to have `MetaSized` and
`PointeeSized` added to them.
2025-06-16 23:04:36 +00:00
Guillaume Gomez
b796179f98 Created tests/rustdoc/reexports subfolder to limit number of files at the top level 2025-05-05 17:47:17 +02:00