Don't return dummy MacroData in get_macro#156151
Don't return dummy MacroData in get_macro#156151mejrs wants to merge 1 commit intorust-lang:mainfrom
get_macro#156151Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? petrochenkov for further review |
This comment has been minimized.
This comment has been minimized.
| } | ||
| _ => None, | ||
| }, | ||
| None => self.get_macro(res).map(|macro_data| Arc::clone(¯o_data.ext)), |
There was a problem hiding this comment.
This change is also no longer necessary.
There was a problem hiding this comment.
My primary motivation for this change here (and this PR in general) is that this is something I ran into while trying to make a diagnostic attribute act like a syntax extension; a macro named (say) "on_unimplemented" in a module named "diagnostic" takes precedence over a similarly named tool attribute, so I can't use (just) get_macro to tell whether to insert that syntax extension or not.
But I'll need to think some more about how to best do that; I think that's going to end up looking like this change. Happy to do it later though; I've dropped it.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
I was experimenting with tool attributes and ast manipulation, and wasted some time figuring out that this was happening. AFAIK all users of
get_macroare expecting an actual macro (and none were reading the dummy MacroData) so there should be no change in behavior.