let what_rustc_thinks = Item::from_hir_id_and_parts(
self.id,
- self.name,
+ Some(self.name),
ModuleItem(Module { is_crate: self.is_crate, items }),
cx,
);
name: &mut Symbol,
cx: &mut DocContext<'_>,
) -> ItemKind {
- let macro_kind = item.attrs.iter().find_map(|a| {
+ let attrs = cx.tcx.hir().attrs(item.hir_id());
+ let macro_kind = attrs.iter().find_map(|a| {
if a.has_name(sym::proc_macro) {
Some(MacroKind::Bang)
} else if a.has_name(sym::proc_macro_derive) {
match macro_kind {
Some(kind) => {
if kind == MacroKind::Derive {
- *name = item
- .attrs
+ *name = attrs
.lists(sym::proc_macro_derive)
.find_map(|mi| mi.ident())
.expect("proc-macro derives require a name")
}
let mut helpers = Vec::new();
- for mi in item.attrs.lists(sym::proc_macro_derive) {
+ for mi in attrs.lists(sym::proc_macro_derive) {
if !mi.has_name(sym::attributes) {
continue;
}
}
}
TyKind::Path(_) => clean_qpath(&self, cx),
- TyKind::TraitObject(ref bounds, ref lifetime) => {
+ TyKind::TraitObject(ref bounds, ref lifetime, _) => {
match bounds[0].clean(cx).trait_ {
ResolvedPath { path, param_names: None, did, is_generic } => {
let mut bounds: Vec<self::GenericBound> = bounds[1..]
}
}
-impl Clean<Item> for hir::StructField<'_> {
+impl Clean<Item> for hir::FieldDef<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
let what_rustc_thinks = Item::from_hir_id_and_parts(
self.hir_id,
let cnum = cx.tcx.extern_mod_stmt_cnum(krate.def_id).unwrap_or(LOCAL_CRATE);
// this is the ID of the crate itself
let crate_def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
+ let attrs = cx.tcx.hir().attrs(krate.hir_id());
let please_inline = krate.vis.node.is_pub()
- && krate.attrs.iter().any(|a| {
+ && attrs.iter().any(|a| {
a.has_name(sym::doc)
&& match a.meta_item_list() {
Some(l) => attr::list_contains_name(&l, sym::inline),
cx.tcx.parent_module(krate.hir_id()).to_def_id(),
res,
name,
- Some(krate.attrs),
+ Some(attrs),
&mut visited,
) {
return items;
}
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
vec![Item {
- name: None,
- attrs: box krate.attrs.clean(cx),
+ name: Some(name),
+ attrs: box attrs.clean(cx),
source: krate.span.clean(cx),
def_id: crate_def_id,
visibility: krate.vis.clean(cx),
- kind: box ExternCrateItem(name, orig_name),
+ kind: box ExternCrateItem { src: orig_name },
}]
}
return Vec::new();
}
- let inline_attr = import.attrs.lists(sym::doc).get_word_attr(sym::inline);
+ let attrs = cx.tcx.hir().attrs(import.hir_id());
+ let inline_attr = attrs.lists(sym::doc).get_word_attr(sym::inline);
let pub_underscore = import.vis.node.is_pub() && name == kw::Underscore;
if pub_underscore {
// Don't inline doc(hidden) imports so they can be stripped at a later stage.
let mut denied = !import.vis.node.is_pub()
|| pub_underscore
- || import.attrs.iter().any(|a| {
+ || attrs.iter().any(|a| {
a.has_name(sym::doc)
&& match a.meta_item_list() {
Some(l) => {
cx.tcx.parent_module(import.hir_id()).to_def_id(),
path.res,
name,
- Some(import.attrs),
+ Some(attrs),
&mut visited,
) {
items.push(Item::from_def_id_and_parts(