-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
Conversation
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) { |
There was a problem hiding this comment.
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)?)
There was a problem hiding this comment.
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! 😅
@bors r+ |
📌 Commit e78fb9b has been approved by |
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
☀️ Test successful - status-appveyor, status-travis |
When i moved the macro cross-re-export inlining code into
clean::inline
, i thought that if a macro had aDef
that said it was a bang macro, it wouldn't be a proc macro. I thought wrong. Turns out, thequote!()
inlibproc_macro
is actually a proc-macro, and when thequote!()
macro is re-exported, this proc-macro is accessed in its place. This causes anyproc_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