Skip to content

Conversation

@GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Dec 12, 2025

Follow-up of #149645.

The change I made was slightly wrong. Originally the check was:

        if let Some(item_list) = attr.meta_item_list() {
            for item in item_list {
                if !item.has_name(sym::inline) {

So we were checking that there was no doc(inline) attribute. This PR should fix it.

r? @lqd

@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2025

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 12, 2025
@fmease
Copy link
Member

fmease commented Dec 12, 2025

Is this regression user observable? If so, it would be nice to add a test exercising it.

@GuillaumeGomez
Copy link
Member Author

Would be nice indeed. Gonna try to trigger a bug with it.

@lqd
Copy link
Member

lqd commented Dec 12, 2025

So that should bring back the crate metadata "lost" in the previous PR, right? We could do a perf run :3

r=me with the test if it's possible to craft one

@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@GuillaumeGomez
Copy link
Member Author

So the regression is actually observable but I can't reproduce it locally: the source links are not present in a lot of std items (like OnceCell). I tried x.py doc library in both stage 1 and stage 2 and they always have their source links. I tried with other approaches (always with reexports) but no luck.

So this PR is a very annoying mix of "believe me it works" and "we'll see once this is merged and std is regenerated if it fixed the issue". But if someone is able to write a reproducer, I'd be EXTREMELY thankful as this is a very big issue.

Anyway, PR should be ready. I implemented Encodable by hand (copied the expanded macro code) to exclude doc(inline) to mimic previous behaviour, but I'm pretty sure the original code was also wrong.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

If I don't commit all changes, obviously things can't work...

@lqd
Copy link
Member

lqd commented Dec 15, 2025

So the regression is actually observable but I can't reproduce it locally: the source links are not present in a lot of std items (like OnceCell). I tried x.py doc library in both stage 1 and stage 2 and they always have their source links. I tried with other approaches (always with reexports) but no luck.

Would looking at the std docs of a try build reproduce the issue then? (CI or opt-dist may need to be checked to ensure that the docs will be built for a try build).

As far as the current implementation goes, it’s not the prettiest but it seems our hands are somewhat tied due to preserving the possibly unexpected current encoding w/r/t doc inlining. In that sense I don’t mind it too much as it fixes the issue, it seems, but would also appreciate @fmease’s opinion.

Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 16, 2025
…on, r=Kobzol

Generate macro expansion for rust compiler crates docs

This enables the `--generate-macro-expansion` rustdoc flag, generating possibility to expand macros directly in source code pages (rust-lang#137229).

Needed this new feature when I was working on rust-lang#149919 and I thought "why not enable it by default?". So here we go.

Not too sure who to r? here so:

r? `@kobzol`
@Urgau
Copy link
Member

Urgau commented Dec 16, 2025

I don't know if it's worth much, but if I take a look at PR CI generated doc (in the "Artifacts" section), I can see that the "Source" links are present.

image

@GuillaumeGomez
Copy link
Member Author

Can you check for std::cell::OnceCell too please?

@Urgau
Copy link
Member

Urgau commented Dec 16, 2025

Seems to be present as well.

image

@GuillaumeGomez
Copy link
Member Author

So seems like the fix is all good. Drives me nuts to be unable to have a local reproducer though... I thought reexports of deps would be enough but doesn't seem so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants