Commit graph

12 commits

Author SHA1 Message Date
lcnr
8ac1f9d27d fix rustdoc test
(cherry picked from commit 337abba988)
2026-02-12 09:06:14 -08:00
bors
fe98ddcfcf Auto merge of #151232 - fmease:rustdoc-dont-eval-assoc-consts, r=yotamofek
rustdoc: Stop unconditionally evaluating the initializer of associated consts

See the descriptions of the added tests for details.

Fixes rust-lang/rust#131625.
Fixes [after beta-1.93 backport] rust-lang/rust#149635.
Fixes rust-lang/rust#150312.

Supersedes rust-lang/rust#150629 IINM.

CC @cuviper (https://github.com/rust-lang/rust/issues/149635#issuecomment-3761125727)
r? @GuillaumeGomez or @yotamofek (rust-lang/rust#150629)
2026-01-17 16:15:18 +00:00
León Orell Valerian Liehr
ac8e8505b7
rustdoc: Stop unconditionally evaluating the initializer of associated consts 2026-01-17 12:12:36 +01:00
Stuart Cook
176bf87df0
Rollup merge of #151120 - ice-deprecated-note-on-reexport, r=lolbinarycat
Fix deprecated attribute intra-doc link not resolved in the right location on reexported item

Fixes https://github.com/rust-lang/rust/issues/151028.
Follow-up of https://github.com/rust-lang/rust/pull/150721.

So when we resolve an intra-doc link, its current context (the module from which we resolve in short) is very important. However, when we use an intra-doc link in a `#[deprecated]` attribute on a reexported item, we were using the context of the reexported item and not of the `use` itself. Meaning that if you have an intra-doc link `std::mem::drop` on an item from another crate (let's say `core`), then the import will simply fail since there is no `std` dependency.

Now comes the not so funny fix: at this point, we don't know anymore where the attribute came from (ie, from the reexport or from the reexported item) since we already merged the attribute at this point. The solution I found to go around this problem is to check if the item span contains the attribute, and if not, then we use the `inline_stmt_id` as context instead of the item's ID. I'm not super happy and I'm sure we'll find corner cases in the future (like with macros), however there are a few things that mitigate this fix:
1. The only way to generate an attribute with a macro with its item while having different spans is by using proc-macros. In that case, we can always default to the `inline_stmt_id` as context and be fine, but I guess we'll see when get there.
2. It only concerns reexports, so the area of the problem is quite restricted.

Hopefully this explanation made sense. :)

cc @folkertdev
r? @lolbinarycat
2026-01-17 11:47:18 +11:00
Jonathan Brouwer
e04af73628
Rollup merge of #150586 - intra-doc-assoc-alias, r=GuillaumeGomez
rustdoc: Fix intra-doc link bugs involving type aliases and associated items

This PR:
- Add support for linking to fields of variants behind a type alias.
- Correctly resolve links to fields and variants behind a type alias to the alias's version of the docs.
- Refactor some intra-doc links code to make it simpler.
- Add tests for the status quo of linking to associated items behind aliases.

Future steps:
- Nail down the rules of when inherent and trait impls are inlined into an alias's docs, and when impls on the alias appear for the aliased type.
- Adjust the resolutions of intra-doc links, through aliases, to associated items based on these rules.

r? @GuillaumeGomez
2026-01-14 22:29:55 +01:00
Guillaume Gomez
c341745970 Add regression test for #151028 2026-01-14 21:52:30 +01:00
Guillaume Gomez
3daf9935c5
Rollup merge of #150561 - semiopaque, r=BoxyUwU
Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`

Since it's a bit annoying to have different names for the same thing.

My understanding is that this is just internal stuff that is not part of any public API even tough rust-analyzer knows about it.

Continuation of
- https://github.com/rust-lang/rust/pull/139084.

Discovered while investigating
- https://github.com/rust-lang/rust/issues/150514
2026-01-09 11:59:59 +01:00
Noah Lev
2b618ed6da rustdoc: Correctly resolve variant and struct fields on alias 2026-01-08 13:41:46 -08:00
Noah Lev
98d3026c41 Resolve intra-doc links to variant fields behind type aliases
Previously, these failed to resolve, despite them working for struct
fields or enum variants that were behind aliases.

However, there is now an inconsistency where enum variant fields behind
an alias resolve to the entry on the alias's page, while enum variants
and struct fields resolve to the page of the backing ADT.
2026-01-08 11:19:02 -08:00
Martin Nordholts
8e3d60447c Finish transition from semitransparent to semiopaque for rustc_macro_transparency 2026-01-08 19:14:45 +01:00
Folkert de Vries
3be74a7441
render intra-doc links in the #[deprectated] note 2026-01-08 11:35:33 +01:00
Guillaume Gomez
a928f3352d Rename tests/rustdoc into tests/rustdoc-html 2026-01-07 14:23:30 +01:00