mod span_utils;
mod sig;
-use rustc::hir;
-use rustc::hir::def::{CtorOf, DefKind as HirDefKind, Res};
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
-use rustc::hir::Node;
use rustc::middle::cstore::ExternCrate;
use rustc::middle::privacy::AccessLevels;
use rustc::session::config::{CrateType, Input, OutputType};
use rustc::ty::{self, DefIdTree, TyCtxt};
use rustc::{bug, span_bug};
use rustc_codegen_utils::link::{filename_for_metadata, out_filename};
+use rustc_hir as hir;
+use rustc_hir::def::{CtorOf, DefKind as HirDefKind, Res};
+use rustc_hir::def_id::{DefId, LOCAL_CRATE};
+use rustc_hir::Node;
use std::cell::Cell;
use std::default::Default;
use std::io::BufWriter;
use std::path::{Path, PathBuf};
+use rustc_span::source_map::Spanned;
use rustc_span::*;
use syntax::ast::{self, Attribute, NodeId, PatKind, DUMMY_NODE_ID};
use syntax::print::pprust;
use syntax::print::pprust::{param_to_string, ty_to_string};
-use syntax::source_map::Spanned;
use syntax::util::comments::strip_doc_comment_decoration;
use syntax::visit::{self, Visitor};
attributes: lower_attributes(item.attrs.clone(), self),
}))
}
- ast::ItemKind::Impl(.., ref trait_ref, ref typ, ref impls) => {
- if let ast::TyKind::Path(None, ref path) = typ.kind {
+ ast::ItemKind::Impl { ref of_trait, ref self_ty, ref items, .. } => {
+ if let ast::TyKind::Path(None, ref path) = self_ty.kind {
// Common case impl for a struct or something basic.
if generated_code(path.span) {
return None;
let impl_id = self.next_impl_id();
let span = self.span_from_span(sub_span);
- let type_data = self.lookup_def_id(typ.id);
+ let type_data = self.lookup_def_id(self_ty.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: trait_ref
+ to: of_trait
.as_ref()
.and_then(|t| self.lookup_def_id(t.ref_id))
.map(id_from_def_id)
},
Impl {
id: impl_id,
- kind: match *trait_ref {
+ kind: match *of_trait {
Some(_) => ImplKind::Direct,
None => ImplKind::Inherent,
},
span: span,
value: String::new(),
parent: None,
- children: impls
+ children: items
.iter()
.map(|i| id_from_node_id(i.id, self))
.collect(),
{
Some(impl_id) => match self.tcx.hir().get_if_local(impl_id) {
Some(Node::Item(item)) => match item.kind {
- hir::ItemKind::Impl(.., ref ty, _) => {
+ hir::ItemKind::Impl { ref self_ty, .. } => {
let mut qualname = String::from("<");
- qualname.push_str(&self.tcx.hir().hir_to_pretty_string(ty.hir_id));
+ qualname.push_str(&self.tcx.hir().hir_to_pretty_string(self_ty.hir_id));
let trait_id = self.tcx.trait_id_of_impl(impl_id);
let mut decl_id = None;