Skip to content

rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro - #110279

Merged
bors merged 2 commits into
rust-lang:masterfrom
GuillaumeGomez:compiler-macro-derive
Apr 14, 2023
Merged

rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro#110279
bors merged 2 commits into
rust-lang:masterfrom
GuillaumeGomez:compiler-macro-derive

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

Part of #110111.

There were actually one issue split in two parts:

  • Compiler built-in proc-macro were incorrectly considered as macros and not proc-macros.
  • Re-exports of compiler built-in proc-macros were considering them as macros.

Both issues can be fixed by looking at the MacroKind variant instead of just relying on information extracted later on.

r? @fmease

@rustbot

Copy link
Copy Markdown
Collaborator

Failed to set assignee to fmease: invalid assignee

Note: Only org members, users with write permissions, or people who have commented on the PR may be assigned.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 13, 2023
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

I keep forgetting you don't have r+ rights... Let's set @notriddle as reviewer then (but your input is very welcome!).

r? @notriddle

Comment threadsrc/librustdoc/clean/mod.rs Outdated

@fmeasefmeaseApr 13, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as far as I understand we treat non-bang macro declarations (macro or macro_rules!) as proc macros because we assume that they have #[rustc_builtin_macro] on them and since currently there is no way to define attributes and derive macros via declarative macros, right?

Seems fine to me, although that fact could change in the far™ future. If that happened we'd "need" new ItemTypes anyway.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as you can see in the test I updated. We'll see if it ever happen but I never heard of it (if you have a link to a discussion about it, I'm very interested!).

@fmeasefmeaseApr 13, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to link to, no. I faintly remember reading discussions about it someplace sometime ago.

Comment threadtests/rustdoc/macro_pub_in_module.rs Outdated
Comment threadtests/rustdoc/macro_pub_in_module.rs Outdated
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Added suggested checks.

@notriddle

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@bors

bors commented Apr 14, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 80c4323 has been approved by notriddle

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 14, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 14, 2023
…ve, r=notriddle
rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro
Part of rust-lang#110111.
There were actually one issue split in two parts:
* Compiler built-in proc-macro were incorrectly considered as macros and not proc-macros.
* Re-exports of compiler built-in proc-macros were considering them as macros.
Both issues can be fixed by looking at the `MacroKind` variant instead of just relying on information extracted later on.
r? `@fmease`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 14, 2023
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#109225 (Clarify that RUST_MIN_STACK may be internally cached)
- rust-lang#109800 (Improve safe transmute error reporting)
- rust-lang#110158 (Remove obsolete test case)
- rust-lang#110180 (don't uniquify regions when canonicalizing)
- rust-lang#110207 (Assemble `Unpin` candidates specially for generators in new solver)
- rust-lang#110276 (Remove all but one of the spans in `BoundRegionKind::BrAnon`)
- rust-lang#110279 (rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro)
- rust-lang#110298 (Cover edge cases for {f32, f64}.hypot() docs)
- rust-lang#110299 (Switch to `EarlyBinder` for `impl_subject` query)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 35bd52e into rust-lang:masterApr 14, 2023
@rustbotrustbot added this to the 1.70.0 milestone Apr 14, 2023
@GuillaumeGomez
GuillaumeGomez deleted the compiler-macro-derive branch April 14, 2023 11:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@GuillaumeGomez@rustbot@notriddle@bors@fmease