Skip to content

Commit 53a963c

Browse files
Rollup merge of #145782 - karolzwolak:rustdoc-consistent-attributes-rendering, r=GuillaumeGomez
rustdoc: make attributes render consistently While working on rust-lang/rust#132304, I discovered that even standard attributes aren't consistently rendered. For some constructs/fields, attributes were missing entirely, and the attributes were only sometimes wrapped in a code-attribute divs so they appear greyed out. In short this PR: * makes attributes render inside code elements and inside divs with class `code-attribute` * renders attributes for macros, associated constants, and struct/union fields Attributes in `Fields` and `Variants` sections are still not rendered (see struct and enum screenshots), because I wasn't sure we want that. [Compirison of tests/rustdoc/attributes.rs](https://github.com/karolzwolak/rust/blob/90aa25a1c5dbae1e94099b1a2015dfb83783dbe0/tests/rustdoc/attributes.rs) Before (left) / after (right): <img width="279" height="97" alt="image" src="https://github.com/user-attachments/assets/baca4b75-f809-4a76-8ac1-e3aa6389aad4" /> <img width="363" height="112" alt="image" src="https://github.com/user-attachments/assets/14970fb0-6fe5-474f-983e-5a95e16175c5" /> <img width="368" height="492" alt="image" src="https://github.com/user-attachments/assets/f9a25583-10e3-49c7-961b-34f3587b552e" /> <img width="415" height="515" alt="image" src="https://github.com/user-attachments/assets/f2fe4aa0-c731-4f2f-a3c2-04e524a858d1" /> <img width="383" height="483" alt="image" src="https://github.com/user-attachments/assets/bccc1b6e-f236-4948-8557-f9b25cad8a07" /> <img width="402" height="528" alt="image" src="https://github.com/user-attachments/assets/2cea9250-37e1-439e-8010-0603905d0f52" /> <img width="372" height="485" alt="image" src="https://github.com/user-attachments/assets/cd49bc0a-90e1-4d08-af0f-084c42af1834" /> <img width="406" height="542" alt="image" src="https://github.com/user-attachments/assets/67fb4ac7-746b-4e20-9c80-97702a71def8" /> <img width="357" height="131" alt="image" src="https://github.com/user-attachments/assets/42769532-1e4d-486d-bdca-6ecc409554b9" /> <img width="366" height="161" alt="image" src="https://github.com/user-attachments/assets/0b4d01d4-dd8e-4467-8cfc-ad58200ba0d7" /> <img width="291" height="65" alt="image" src="https://github.com/user-attachments/assets/43f61335-8eff-491b-a297-1953d17bbfc0" /> <img width="259" height="57" alt="image" src="https://github.com/user-attachments/assets/598618a3-e52f-4a4e-b790-2c8d5f1b4c77" /> r? ``@GuillaumeGomez``
2 parents 3a97594 + c070d27 commit 53a963c

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)