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
Jacob Pratt
e6b80f3407
Rollup merge of #143849 - lolbinarycat:rustdoc-priv-normalize-143222, r=GuillaumeGomez
...
rustdoc: never link to unnamable items
fixes rust-lang/rust#143222
2025-08-01 00:38:19 -04:00
Kornel
0813cc9dcf
Test renamed crates in rustdoc
2025-07-28 13:34:03 +01: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
Jacob Pratt
01fe1c0b0e
Rollup merge of #143381 - fee1-dead-contrib:push-pzxuvlnymxpu, r=GuillaumeGomez
...
rustdoc: don't treat methods under const impls or traits as const
Fixes rust-lang/rust#143071
2025-07-04 05:47:28 +02:00
Guillaume Gomez
678ec9bbd4
Rollup merge of #141831 - lolbinarycat:rustdoc-extern-reexport-135092, r=GuillaumeGomez
...
rustdoc: fix attrs of locally reexported foreign items
fixes rust-lang/rust#135092
also tweaks a few outdated/misleading comments.
r? `@GuillaumeGomez`
2025-07-03 19:45:30 +02:00
Deadbeef
510e5d7e66
rustdoc: don't treat methods under const impls or traits as const
2025-07-03 23:16:47 +08:00
Jana Dönszelmann
622722aada
Rollup merge of #143083 - JonathanBrouwer:rustdoc-fix, r=jdonszelmann
...
Fix rustdoc not correctly showing attributes on re-exports
Fixes attributes not being shown correctly in rustdoc on re-exports
Does this need to be backported to beta?
r? ``@jdonszelmann``
2025-07-03 13:29:37 +02:00
Matthias Krüger
e5bd07ac2e
Rollup merge of #142367 - GuillaumeGomez:extern-crate-items-intra-doc, r=lolbinarycat
...
Add regression test for #137857 to ensure that we generate intra doc links for extern crate items.
Fixes https://github.com/rust-lang/rust/issues/137857 .
I checked that linking to extern crates was generating valid links (with the `/index.html` part) and since it's already working, just adding a regression test.
r? `@notriddle`
2025-06-29 06:59:28 +02:00
Matthias Krüger
8f30a98591
Rollup merge of #142987 - lolbinarycat:rustdoc-non_exhaustive-enum-v-142599, r=GuillaumeGomez
...
rustdoc: show attributes on enum variants
mostly for #[non_exhaustive]
unsure if there's any attributes we should take care to *not* include, it could use `render_code_attribute` and `is_non_exhaustive` instead, if that is a concern.
fixes rust-lang/rust#142599
2025-06-28 22:05:30 +02:00
Guillaume Gomez
1052ddda96
Add regression test for #137857 to ensure that we generate intra doc links for extern crate items.
2025-06-28 11:27:12 +02:00
Jonathan Brouwer
58418d881a
Fix rustdoc not correctly showing attributes with re-exports
...
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27 23:31:25 +02:00
Matthias Krüger
36c2b011cb
Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-dead
...
New const traits syntax
This PR only affects the AST and doesn't actually change anything semantically.
All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser
Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error
r? ``@fee1-dead``
cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
2025-06-27 22:13:00 +02:00
binarycat
f7321becd2
rustdoc: add regression test for issue 135092
2025-06-27 11:49:12 -05:00
binarycat
b2be01c815
rustdoc: show attributes on enum variants
...
mostly for #[non_exhaustive]
2025-06-26 12:33:30 -05:00
Oli Scherer
eb7245a864
Change const trait bound syntax from ~const to [const]
2025-06-26 13:46:45 +00:00
Alona Enraght-Moony
84f92f3211
rustdoc: Don't mark #[target_feature]
functions as ⚠
...
Closes https://www.github.com/rust-lang/rust/issues/142952
2025-06-24 18:55:45 +00:00
David Wood
388a99ea26
rustdoc: PointeeSized
bounds with extern types
...
As before, updating types using extern types to use `PointeeSized`
bounds.
2025-06-16 23:04:36 +00: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
bors
8da623945f
Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgr
...
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
2025-06-13 17:44:15 +00:00
Matthias Krüger
06dc33853e
Rollup merge of #141770 - GuillaumeGomez:cfg-false-mod-rendering, r=camelid
...
Merge `Cfg::render_long_html` and `Cfg::render_long_plain` methods common code
Follow-up of https://github.com/rust-lang/rust/pull/141747 .
Thanks `@camelid` for spotting it!
r? `@camelid`
2025-06-13 05:16:55 +02:00
Trevor Gross
208cb5da15
Fix a missing fragment specifier in rustdoc tests
2025-06-12 07:35:00 +00:00
León Orell Valerian Liehr
95bf1275f5
Support middle::ty assoc const eq predicates again
2025-06-05 19:19:18 +02:00
Guillaume Gomez
fca28ab513
* Add test case for cfg(false)
on module level
...
* Fix typo
* Remove usage of `!has`
2025-06-03 10:35:28 +02:00
Matthias Krüger
71529f59b1
Rollup merge of #141747 - lolbinarycat:rustdoc-cfg-138112, r=GuillaumeGomez
...
rustdoc: display doc(cfg(false)) properly
before we had an extra 'on' that was
ungramatical.
fixes https://github.com/rust-lang/rust/issues/138112
this is what it looks like now:

2025-05-30 07:01:31 +02:00
binarycat
c6eb1d95d3
rustdoc: display doc(cfg(false)) properly
...
before we had an extra 'on' that was
ungramatical.
fixes https://github.com/rust-lang/rust/issues/138112
2025-05-29 15:40:50 -05:00
Trevor Gross
77c7f76297
Rollup merge of #141411 - lolbinarycat:rustdoc-link-proc-macro-91274, r=GuillaumeGomez
...
rustdoc: linking to a local proc macro no longer warns
fixes https://github.com/rust-lang/rust/issues/91274
tried to keep the fix general in case we ever have any other kind of item that occupies
multiple namespaces simultaniously.
2025-05-28 10:28:09 -04:00
Trevor Gross
a8c7a1e29b
Rollup merge of #141517 - lolbinarycat:rustdoc-doctest-tooltip-ignore-141092, r=notriddle
...
rustdoc: use descriptive tooltip if doctest is conditionally ignored
fixes https://github.com/rust-lang/rust/issues/141092
here's what it looks like now:

2025-05-27 20:28:32 -04:00
binarycat
871327e9c7
rustdoc: linking to a local proc macro no longer warns
...
fixes https://github.com/rust-lang/rust/issues/91274
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-05-27 10:03:05 -05:00
Guillaume Gomez
2b292d1b78
Add regression test for #140739
2025-05-25 15:10:24 +02:00
Guillaume Gomez
4f3dd7b018
Tweak attribute rendering depending on wether or not it is a type alias
2025-05-25 15:10:23 +02:00
binarycat
4ef35bcaef
rustdoc: use descriptive tooltip if doctest is conditionally ignored
...
fixes https://github.com/rust-lang/rust/issues/141092
2025-05-24 14:15:20 -05:00
Guillaume Gomez
27e39c3ac6
Created tests/rustdoc/async
subfolder to limit number of files at the top level
2025-05-05 17:49:12 +02:00
Guillaume Gomez
e14e19a67d
Created tests/rustdoc/extern
subfolder to limit number of files at the top level
2025-05-05 17:49:12 +02:00
Guillaume Gomez
e245c3bc6b
Move primitive rustdoc tests into the primitive
sub folder
2025-05-05 17:47:18 +02:00
Guillaume Gomez
4b6bc73507
Created tests/rustdoc/enum
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
fa2b9227a1
Created tests/rustdoc/assoc
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
b84f4cc39e
Created tests/rustdoc/impl
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
be71d8b24f
Created tests/rustdoc/doc-cfg
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
d1f4a0bcb6
Created tests/rustdoc/macro
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
eee6c97535
Created tests/rustdoc/private
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
a00b39961a
Move intra-doc tests into the expected subfolder
2025-05-05 17:47:18 +02:00
Guillaume Gomez
9db7de5915
Created tests/rustdoc/jump-to-def
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
ff971d001d
Created tests/rustdoc/auto
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
b374996ab8
Created tests/rustdoc/anchors
subfolder to limit number of files at the top level
2025-05-05 17:47:18 +02:00
Guillaume Gomez
099f730dcf
Created tests/rustdoc/source-code-pages
subfolder to limit number of files at the top level
2025-05-05 17:47:17 +02:00