Rollup merge of #101091 - TaKO8Ki:fix-101076, r=notriddle
Extend attrs if local_def_id exists Fixes #101076
This commit is contained in:
commit
c2f294a73f
@ -41,8 +41,9 @@ impl<'a, 'tcx> DocFolder for CfgPropagator<'a, 'tcx> {
|
|||||||
if self.parent != Some(expected_parent) {
|
if self.parent != Some(expected_parent) {
|
||||||
let mut attrs = Vec::new();
|
let mut attrs = Vec::new();
|
||||||
for (parent_hir_id, _) in hir.parent_iter(hir_id) {
|
for (parent_hir_id, _) in hir.parent_iter(hir_id) {
|
||||||
let def_id = hir.local_def_id(parent_hir_id).to_def_id();
|
if let Some(def_id) = hir.opt_local_def_id(parent_hir_id) {
|
||||||
attrs.extend_from_slice(load_attrs(self.cx, def_id));
|
attrs.extend_from_slice(load_attrs(self.cx, def_id.to_def_id()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let (_, cfg) =
|
let (_, cfg) =
|
||||||
merge_attrs(self.cx, None, item.attrs.other_attrs.as_slice(), Some(&attrs));
|
merge_attrs(self.cx, None, item.attrs.other_attrs.as_slice(), Some(&attrs));
|
||||||
|
14
src/test/rustdoc-ui/issue-101076.rs
Normal file
14
src/test/rustdoc-ui/issue-101076.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! first_macro {
|
||||||
|
() => {}
|
||||||
|
}
|
||||||
|
mod foo {
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! second_macro {
|
||||||
|
() => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user