@@ -147,6 +147,17 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
147
147
)
148
148
}
149
149
150
+ fn is_glob_import ( tcx : TyCtxt < ' _ > , import_id : LocalDefId ) -> bool {
151
+ if let Some ( node) = tcx. opt_hir_node_by_def_id ( import_id)
152
+ && let hir:: Node :: Item ( item) = node
153
+ && let hir:: ItemKind :: Use ( _, use_kind) = item. kind
154
+ {
155
+ use_kind == hir:: UseKind :: Glob
156
+ } else {
157
+ false
158
+ }
159
+ }
160
+
150
161
fn generate_item_with_correct_attrs (
151
162
cx : & mut DocContext < ' _ > ,
152
163
kind : ItemKind ,
@@ -157,10 +168,17 @@ fn generate_item_with_correct_attrs(
157
168
) -> Item {
158
169
let target_attrs = inline:: load_attrs ( cx, def_id) ;
159
170
let attrs = if let Some ( import_id) = import_id {
171
+ // glob reexports are treated the same as `#[doc(inline)]` items.
172
+ //
173
+ // For glob re-exports the item may or may not exist to be re-exported (potentially the cfgs
174
+ // on the path up until the glob can be removed, and only cfgs on the globbed item itself
175
+ // matter), for non-inlined re-exports see #85043.
160
176
let is_inline = inline:: load_attrs ( cx, import_id. to_def_id ( ) )
161
177
. lists ( sym:: doc)
162
178
. get_word_attr ( sym:: inline)
163
- . is_some ( ) ;
179
+ . is_some ( )
180
+ || ( is_glob_import ( cx. tcx , import_id)
181
+ && ( cx. render_options . document_hidden || !cx. tcx . is_doc_hidden ( def_id) ) ) ;
164
182
let mut attrs = get_all_import_attributes ( cx, import_id, def_id, is_inline) ;
165
183
add_without_unwanted_attributes ( & mut attrs, target_attrs, is_inline, None ) ;
166
184
attrs
0 commit comments