@@ -63,8 +63,6 @@ pub(crate) fn try_inline(
6363
6464 let import_def_id = attrs. and_then ( |( _, def_id) | def_id) ;
6565
66- let ( attrs, cfg) = merge_attrs ( cx, load_attrs ( cx, did) , attrs) ;
67-
6866 let kind = match res {
6967 Res :: Def ( DefKind :: Trait , did) => {
7068 record_extern_fqn ( cx, did, ItemType :: Trait ) ;
@@ -134,7 +132,11 @@ pub(crate) fn try_inline(
134132 cx. with_param_env ( did, |cx| clean:: ConstantItem ( build_const ( cx, did) ) )
135133 }
136134 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) ;
138140
139141 let type_kind = match kind {
140142 MacroKind :: Bang => ItemType :: Macro ,
@@ -148,8 +150,14 @@ pub(crate) fn try_inline(
148150 } ;
149151
150152 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+ ) ;
153161 // The visibility needs to reflect the one from the reexport and not from the "source" DefId.
154162 item. inline_stmt_id = import_def_id;
155163 ret. push ( item) ;
@@ -179,6 +187,7 @@ pub(crate) fn try_inline_glob(
179187 . iter ( )
180188 . filter ( |child| !child. reexport_chain . is_empty ( ) )
181189 . filter_map ( |child| child. res . opt_def_id ( ) )
190+ . filter ( |def_id| !cx. tcx . is_doc_hidden ( def_id) )
182191 . collect ( ) ;
183192 let attrs = cx. tcx . hir ( ) . attrs ( import. hir_id ( ) ) ;
184193 let mut items = build_module_items (
0 commit comments