Compute parent module when collecting hir::MacroDef.#80415
Compute parent module when collecting hir::MacroDef.#80415bors merged 3 commits intorust-lang:masterfrom
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
|
@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