#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
+#![feature(if_let_guard)]
#![feature(nll)]
+#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "256"]
mod dump_visitor;
attributes: lower_attributes(attrs.to_vec(), self),
}))
}
- hir::ItemKind::Impl(hir::Impl { ref of_trait, ref self_ty, ref items, .. }) => {
- if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = self_ty.kind {
- // Common case impl for a struct or something basic.
- if generated_code(path.span) {
- return None;
- }
- let sub_span = path.segments.last().unwrap().ident.span;
- filter!(self.span_utils, sub_span);
+ hir::ItemKind::Impl(hir::Impl { ref of_trait, ref self_ty, ref items, .. })
+ if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = self_ty.kind =>
+ {
+ // Common case impl for a struct or something basic.
+ if generated_code(path.span) {
+ return None;
+ }
+ let sub_span = path.segments.last().unwrap().ident.span;
+ filter!(self.span_utils, sub_span);
- let impl_id = self.next_impl_id();
- let span = self.span_from_span(sub_span);
+ let impl_id = self.next_impl_id();
+ let span = self.span_from_span(sub_span);
- let type_data = self.lookup_def_id(self_ty.hir_id);
- type_data.map(|type_data| {
- Data::RelationData(
- Relation {
- kind: RelationKind::Impl { id: impl_id },
- span: span.clone(),
- from: id_from_def_id(type_data),
- to: of_trait
- .as_ref()
- .and_then(|t| self.lookup_def_id(t.hir_ref_id))
- .map(id_from_def_id)
- .unwrap_or_else(null_id),
- },
- Impl {
- id: impl_id,
- kind: match *of_trait {
- Some(_) => ImplKind::Direct,
- None => ImplKind::Inherent,
- },
- span,
- value: String::new(),
- parent: None,
- children: items
- .iter()
- .map(|i| id_from_def_id(i.id.def_id.to_def_id()))
- .collect(),
- docs: String::new(),
- sig: None,
- attributes: vec![],
+ let type_data = self.lookup_def_id(self_ty.hir_id);
+ type_data.map(|type_data| {
+ Data::RelationData(
+ Relation {
+ kind: RelationKind::Impl { id: impl_id },
+ span: span.clone(),
+ from: id_from_def_id(type_data),
+ to: of_trait
+ .as_ref()
+ .and_then(|t| self.lookup_def_id(t.hir_ref_id))
+ .map(id_from_def_id)
+ .unwrap_or_else(null_id),
+ },
+ Impl {
+ id: impl_id,
+ kind: match *of_trait {
+ Some(_) => ImplKind::Direct,
+ None => ImplKind::Inherent,
},
- )
- })
- } else {
- None
- }
+ span,
+ value: String::new(),
+ parent: None,
+ children: items
+ .iter()
+ .map(|i| id_from_def_id(i.id.def_id.to_def_id()))
+ .collect(),
+ docs: String::new(),
+ sig: None,
+ attributes: vec![],
+ },
+ )
+ })
}
+ hir::ItemKind::Impl(_) => None,
_ => {
// FIXME
bug!();