Repository: rust-lang/rust
File: src/librustdoc/html/render/print_item.rs (Rust)

Code before:
                                    "{}extern crate {} as {};",
                                    visibility_print_with_space(myitem, cx),
                                    print_anchor(myitem.item_id.expect_def_id(), src, cx),
                                    EscapeBodyTextWithWbr(myitem.name.unwrap().as_str())
                                )?;
                            }
                            None => {
                                write!(
                                    w,
                                    "{}extern crate {};",
                                    visibility_print_with_space(myitem, cx),
                                    print_anchor(
                                        myitem.item_id.expect_def_id(),
                                        myitem.name.unwrap(),
                                        cx
                                    )
                                )?;
                            }
                        }
                        write!(w, "</code></dt>")?
                    }
                    clean::ImportItem(ref import) => {
                        let stab_tags =
                            import.source.did.map_or_else(String::new, |import_def_id| {
                                print_extra_info_tags(tcx, myitem, item, Some(import_def_id))
                                    .to_string()
                            });
                        let id = match import.kind {
                            clean::ImportKind::Simple(s) => {
                                format!(" id=\"{}\"", cx.derive_id(format!("reexport.{s}")))
                            }
                            clean::ImportKind::Glob => String::new(),
                        };
                        write!(
                            w,
                            "<dt{id}>\
                                <code>"
                        )?;
                        render_attributes_in_code(w, myitem, "", cx)?;
                        write!(
                            w,
                            "{vis}{imp}</code>{stab_tags}\
                            </dt>",
                            vis = visibility_print_with_space(myitem, cx),
                            imp = print_import(import, cx),
                        )?;
                    }
                    _ => {
                        if myitem.name.is_none() {
                            continue;
                        }

Review comment (suggestion):
Please add a test for this change too (ie `extern crate` items visible in module pages).

Code after:
                            "<span title=\"Restricted Visibility\">&nbsp;🔒</span> "
                        }
                    }
                    _ if item.is_doc_hidden() => "<span title=\"Hidden item\">&nbsp;👻</span> ",
                    _ => "",
                };

                match myitem.kind {
                    clean::ExternCrateItem { ref src } => {
                        use crate::html::format::print_anchor;

                        let visibility_and_hidden = visibility_and_hidden(myitem);
                        // Module listings use the hidden marker, so skip doc(hidden) here.
                        super::render_attributes_in_code_with_options(
                            w,
                            myitem,
                            "",
                            cx,
                            false,
                            "<dt><code>",
                        )?;
                        match *src {
                            Some(src) => {
                                write!(
                                    w,
                                    "{}extern crate {} as {};",
                                    visibility_print_with_space(myitem, cx),
                                    print_anchor(myitem.item_id.expect_def_id(), src, cx),
                                    EscapeBodyTextWithWbr(myitem.name.unwrap().as_str())
                                )?;
                            }
                            None => {
                                write!(
                                    w,
                                    "{}extern crate {};",
                                    visibility_print_with_space(myitem, cx),
                                    print_anchor(
                                        myitem.item_id.expect_def_id(),
                                        myitem.name.unwrap(),
                                        cx
                                    )
                                )?;
                            }
                        }
                        write!(w, "</code>{visibility_and_hidden}</dt>")?
                    }
                    clean::ImportItem(ref import) => {
                        let (stab_tags, deprecation) = match import.source.did {
                            Some(import_def_id) => {
                                let stab_tags =
                                    print_extra_info_tags(tcx, myitem, item, Some(import_def_id))