Skip to content

rustdoc: don't panic when the cross-re-export handler sees a proc-macro #52361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2018

Conversation

QuietMisdreavus
Copy link
Member

When i moved the macro cross-re-export inlining code into clean::inline, i thought that if a macro had a Def that said it was a bang macro, it wouldn't be a proc macro. I thought wrong. Turns out, the quote!() in libproc_macro is actually a proc-macro, and when the quote!() macro is re-exported, this proc-macro is accessed in its place. This causes any proc_macro::* glob re-export to pull in this proc-macro, causing the assertion i added to fire, leading to an ICE. This replaces that with an Option that ignores proc-macros for the time being.

Fixes #52129

@QuietMisdreavus
Copy link
Member Author

r? @ollie27

@@ -104,7 +104,11 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
// separately
Def::Macro(did, MacroKind::Bang) => {
record_extern_fqn(cx, did, clean::TypeKind::Macro);
clean::MacroItem(build_macro(cx, did, name))
if let Some(mac) = build_macro(cx, did, name) {
Copy link
Contributor

@LunaBorowska LunaBorowska Jul 14, 2018

Choose a reason for hiding this comment

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

Out of curiosity, is there a reason why it cannot be clean::MacroItem(build_macro(cx, did, name)?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Because i never use the question mark operator, so i never thought about it! 😅

@ollie27
Copy link
Member

ollie27 commented Jul 14, 2018

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 14, 2018

📌 Commit e78fb9b has been approved by ollie27

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 14, 2018
@bors
Copy link
Collaborator

bors commented Jul 15, 2018

⌛ Testing commit e78fb9b with merge ee8cc77...

bors added a commit that referenced this pull request Jul 15, 2018
rustdoc: don't panic when the cross-re-export handler sees a proc-macro

When i moved the macro cross-re-export inlining code into `clean::inline`, i thought that if a macro had a `Def` that said it was a bang macro, it wouldn't be a proc macro. I thought wrong. Turns out, the `quote!()` in `libproc_macro` is actually a proc-macro, and when the `quote!()` macro is re-exported, this proc-macro is accessed in its place. This causes any `proc_macro::*` glob re-export to pull in this proc-macro, causing the assertion i added to fire, leading to an ICE. This replaces that with an Option that ignores proc-macros for the time being.

Fixes #52129
@bors
Copy link
Collaborator

bors commented Jul 15, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: ollie27
Pushing ee8cc77 to master...

@bors bors merged commit e78fb9b into rust-lang:master Jul 15, 2018
@QuietMisdreavus QuietMisdreavus deleted the proc-macro-doc branch July 16, 2018 18:22
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants