@@ -63,8 +63,6 @@ pub(crate) fn try_inline(
63
63
64
64
let import_def_id = attrs. and_then ( |( _, def_id) | def_id) ;
65
65
66
- let ( attrs, cfg) = merge_attrs ( cx, load_attrs ( cx, did) , attrs) ;
67
-
68
66
let kind = match res {
69
67
Res :: Def ( DefKind :: Trait , did) => {
70
68
record_extern_fqn ( cx, did, ItemType :: Trait ) ;
@@ -134,7 +132,11 @@ pub(crate) fn try_inline(
134
132
cx. with_param_env ( did, |cx| clean:: ConstantItem ( build_const ( cx, did) ) )
135
133
}
136
134
Res :: Def ( DefKind :: Macro ( kind) , did) => {
137
- let mac = build_macro ( cx, did, name, import_def_id, kind, attrs. is_doc_hidden ( ) ) ;
135
+ let is_doc_hidden = cx. tcx . is_doc_hidden ( did)
136
+ || attrs_without_docs
137
+ . map ( |( attrs, _) | attrs)
138
+ . is_some_and ( |attrs| utils:: attrs_have_doc_flag ( attrs. iter ( ) , sym:: hidden) ) ;
139
+ let mac = build_macro ( cx, did, name, import_def_id, kind, is_doc_hidden) ;
138
140
139
141
let type_kind = match kind {
140
142
MacroKind :: Bang => ItemType :: Macro ,
@@ -148,8 +150,14 @@ pub(crate) fn try_inline(
148
150
} ;
149
151
150
152
cx. inlined . insert ( did. into ( ) ) ;
151
- let mut item =
152
- clean:: Item :: from_def_id_and_attrs_and_parts ( did, Some ( name) , kind, Box :: new ( attrs) , cfg) ;
153
+ let mut item = crate :: clean:: generate_item_with_correct_attrs (
154
+ cx,
155
+ kind,
156
+ did,
157
+ name,
158
+ import_def_id. and_then ( |def_id| def_id. as_local ( ) ) ,
159
+ None ,
160
+ ) ;
153
161
// The visibility needs to reflect the one from the reexport and not from the "source" DefId.
154
162
item. inline_stmt_id = import_def_id;
155
163
ret. push ( item) ;
@@ -179,6 +187,7 @@ pub(crate) fn try_inline_glob(
179
187
. iter ( )
180
188
. filter ( |child| !child. reexport_chain . is_empty ( ) )
181
189
. filter_map ( |child| child. res . opt_def_id ( ) )
190
+ . filter ( |def_id| !cx. tcx . is_doc_hidden ( def_id) )
182
191
. collect ( ) ;
183
192
let attrs = cx. tcx . hir ( ) . attrs ( import. hir_id ( ) ) ;
184
193
let mut items = build_module_items (
0 commit comments