Skip to content

Conversation

GuillaumeGomez
Copy link
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
Collaborator

rustbot commented Apr 13, 2023

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.

@rustbot rustbot 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
Member Author

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

r? @notriddle

let ty_vis = cx.tcx.visibility(def_id);
MacroItem(Macro {
source: display_macro_source(cx, name, macro_def, def_id, ty_vis),
})
}
ItemKind::Macro(_, macro_kind) => clean_proc_macro(item, &mut name, macro_kind, cx),
Copy link
Member

@fmease fmease Apr 13, 2023

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
Member Author

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!).

Copy link
Member

@fmease fmease Apr 13, 2023

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.

@GuillaumeGomez GuillaumeGomez force-pushed the compiler-macro-derive branch from 42bbfe5 to 80c4323 Compare April 13, 2023 18:35
@GuillaumeGomez
Copy link
Member Author

Added suggested checks.

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 14, 2023

📌 Commit 80c4323 has been approved by notriddle

It is now in the queue for this repository.

@bors bors 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:master Apr 14, 2023
@rustbot rustbot 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant 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