-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Compute parent module when collecting hir::MacroDef. #80415
Conversation
This is awesome, but I don't know enough about HIR to review I think. Is there a way to test this somehow? Maybe you could see if #80414 now generates documentation at core/marker/macro.Copy.html instead of core/macro.Copy.html ? See https://rustc-dev-guide.rust-lang.org/rustdoc-internals.html#dotting-is-and-crossing-ts for how to write rustdoc tests. |
I can't get such a rustdoc test passing. |
Ok, then it looks like there were two separate bugs for #74355, one in rustc and one in rustdoc. r? @petrochenkov maybe? |
What If they are consistent (looks like they should be), then this this PR is good. @cjgillot Could you check both these cases? If they behave as expected, then r=me. |
src/test/rustdoc/macros.rs
Outdated
() => []; | ||
($a:tt) => (); |
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.
Why did you change this?
@petrochenkov, I am not sure how to address your review. How do you recommend I test the consistency? |
@cjgillot |
@petrochenkov, ok thanks. I tested adding the following in the check_attr HIR visitor, and tested a file with both top-level and module macro exports. It passes. use rustc_middle::ty::DefIdTree;
let def_id = self.tcx.hir().local_def_id(macro_def.hir_id);
assert_eq!(
Some(self.tcx.parent_module(macro_def.hir_id).to_def_id()),
self.tcx.parent(def_id.to_def_id())
); Should be good to go. |
@bors r=petrochenkov |
📌 Commit 4fb1236 has been approved by |
☀️ Test successful - checks-actions |
Fixes #77828.
r? @jyn514