@@ -119,7 +119,7 @@ use syntax::abi;
use syntax::ast;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::{self, Span};
use syntax::codemap::{self, Span, Spanned};
use syntax::owned_slice::OwnedSlice;
use syntax::parse::token::{self, InternedString};
use syntax::ptr::P;
@@ -698,7 +698,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
}
hir::ItemFn(..) => {} // entirely within check_item_body
hir::ItemImpl(_, _, _, _, _, ref impl_items) => {
debug!("ItemImpl {} with id {}", it.ident, it.id);
debug!("ItemImpl {} with id {}", it.name, it.id);
match ccx.tcx.impl_trait_ref(DefId::local(it.id)) {
Some(impl_trait_ref) => {
check_impl_items_against_trait(ccx,
@@ -761,7 +761,7 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
check_bare_fn(ccx, &**decl, &**body, it.id, it.span, fn_pty.ty, param_env);
}
hir::ItemImpl(_, _, _, _, _, ref impl_items) => {
debug!("ItemImpl {} with id {}", it.ident, it.id);
debug!("ItemImpl {} with id {}", it.name, it.id);

let impl_pty = ccx.tcx.lookup_item_type(DefId::local(it.id));

@@ -838,14 +838,14 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
Position::ArgumentNamed(s) if s == "Self" => (),
// So is `{A}` if A is a type parameter
Position::ArgumentNamed(s) => match types.iter().find(|t| {
t.ident.name == s
t.name == s
}) {
Some(_) => (),
None => {
span_err!(ccx.tcx.sess, attr.span, E0230,
"there is no type parameter \
{} on trait {}",
s, item.ident);
s, item.name);
}
},
// `{:1}` and `{}` are not to be used
@@ -988,7 +988,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
let is_implemented = impl_items.iter().any(|ii| {
match ii.node {
hir::ConstImplItem(..) => {
ii.ident.name == associated_const.name
ii.name == associated_const.name
}
_ => false,
}
@@ -1009,7 +1009,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
impl_items.iter().any(|ii| {
match ii.node {
hir::MethodImplItem(..) => {
ii.ident.name == trait_method.name
ii.name == trait_method.name
}
_ => false,
}
@@ -1028,7 +1028,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
let is_implemented = impl_items.iter().any(|ii| {
match ii.node {
hir::TypeImplItem(_) => {
ii.ident.name == associated_type.name
ii.name == associated_type.name
}
_ => false,
}
@@ -1058,7 +1058,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
span_err!(tcx.sess, invalidator.span, E0399,
"the following trait items need to be reimplemented \
as `{}` was overridden: `{}`",
invalidator.ident,
invalidator.name,
invalidated_items.iter()
.map(|name| name.to_string())
.collect::<Vec<_>>().join("`, `"))
@@ -2820,7 +2820,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
// Checks a method call.
fn check_method_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
expr: &'tcx hir::Expr,
method_name: hir::SpannedIdent,
method_name: Spanned<ast::Name>,
args: &'tcx [P<hir::Expr>],
tps: &[P<hir::Ty>],
expected: Expectation<'tcx>,
@@ -2836,7 +2836,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
let tps = tps.iter().map(|ast_ty| fcx.to_ty(&**ast_ty)).collect::<Vec<_>>();
let fn_ty = match method::lookup(fcx,
method_name.span,
method_name.node.name,
method_name.node,
expr_t,
tps,
expr,
@@ -2849,7 +2849,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
}
Err(error) => {
method::report_error(fcx, method_name.span, expr_t,
method_name.node.name, Some(rcvr), error);
method_name.node, Some(rcvr), error);
fcx.write_error(expr.id);
fcx.tcx().types.err
}
@@ -2916,7 +2916,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
expr: &'tcx hir::Expr,
lvalue_pref: LvaluePreference,
base: &'tcx hir::Expr,
field: &hir::SpannedIdent) {
field: &Spanned<ast::Name>) {
let tcx = fcx.ccx.tcx;
check_expr_with_lvalue_pref(fcx, base, lvalue_pref);
let expr_t = structurally_resolved_type(fcx, expr.span,
@@ -2933,7 +2933,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
ty::TyStruct(base_def, substs) => {
debug!("struct named {:?}", base_t);
base_def.struct_variant()
.find_field_named(field.node.name)
.find_field_named(field.node)
.map(|f| fcx.field_ty(expr.span, f, substs))
}
_ => None
@@ -2948,7 +2948,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
None => {}
}

if method::exists(fcx, field.span, field.node.name, expr_t, expr.id) {
if method::exists(fcx, field.span, field.node, expr_t, expr.id) {
fcx.type_error_message(
field.span,
|actual| {
@@ -2981,10 +2981,10 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,

// displays hints about the closest matches in field names
fn suggest_field_names<'tcx>(variant: ty::VariantDef<'tcx>,
field: &hir::SpannedIdent,
field: &Spanned<ast::Name>,
tcx: &ty::ctxt<'tcx>,
skip : Vec<InternedString>) {
let name = field.node.name.as_str();
let name = field.node.as_str();
// only find fits with at least one matching letter
let mut best_dist = name.len();
let mut best = None;
@@ -3082,22 +3082,21 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
field: &hir::Field,
skip_fields: &[hir::Field]) {
fcx.type_error_message(
field.ident.span,
field.name.span,
|actual| if let ty::TyEnum(..) = ty.sty {
format!("struct variant `{}::{}` has no field named `{}`",
actual, variant.name.as_str(), field.ident.node)
actual, variant.name.as_str(), field.name.node)
} else {
format!("structure `{}` has no field named `{}`",
actual, field.ident.node)
actual, field.name.node)
},
ty,
None);
// prevent all specified fields from being suggested
let skip_fields = skip_fields.iter().map(|ref x| x.ident.node.name.as_str());
suggest_field_names(variant, &field.ident, fcx.tcx(), skip_fields.collect());
let skip_fields = skip_fields.iter().map(|ref x| x.name.node.as_str());
suggest_field_names(variant, &field.name, fcx.tcx(), skip_fields.collect());
}


fn check_expr_struct_fields<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
adt_ty: Ty<'tcx>,
span: Span,
@@ -3121,15 +3120,15 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
for field in ast_fields {
let expected_field_type;

if let Some(v_field) = remaining_fields.remove(&field.ident.node.name) {
if let Some(v_field) = remaining_fields.remove(&field.name.node) {
expected_field_type = fcx.field_ty(field.span, v_field, substs);
} else {
error_happened = true;
expected_field_type = tcx.types.err;
if let Some(_) = variant.find_field_named(field.ident.node.name) {
span_err!(fcx.tcx().sess, field.ident.span, E0062,
if let Some(_) = variant.find_field_named(field.name.node) {
span_err!(fcx.tcx().sess, field.name.span, E0062,
"field `{}` specified more than once",
field.ident.node);
field.name.node);
} else {
report_unknown_field(fcx, adt_ty, variant, field, ast_fields);
}
@@ -3506,8 +3505,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
let ret_ty = fcx.expr_ty(expr);
fcx.register_wf_obligation(ret_ty, expr.span, traits::MiscObligation);
}
hir::ExprMethodCall(ident, ref tps, ref args) => {
check_method_call(fcx, expr, ident, &args[..], &tps[..], expected, lvalue_pref);
hir::ExprMethodCall(name, ref tps, ref args) => {
check_method_call(fcx, expr, name, &args[..], &tps[..], expected, lvalue_pref);
let arg_tys = args.iter().map(|a| fcx.expr_ty(&**a));
let args_err = arg_tys.fold(false, |rest_err, a| rest_err || a.references_error());
if args_err {
@@ -4939,7 +4938,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
if !*b {
span_err!(ccx.tcx.sess, span, E0091,
"type parameter `{}` is unused",
tps[i].ident);
tps[i].name);
}
}
}
@@ -324,7 +324,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
-> ty::ParamTy
{
let name = match space {
TypeSpace => ast_generics.ty_params[index].ident.name,
TypeSpace => ast_generics.ty_params[index].name,
SelfSpace => special_idents::type_self.name,
FnSpace => self.tcx().sess.bug("Fn space occupied?"),
};
@@ -431,7 +431,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
-> ty::ParamTy
{
let name = match space {
TypeSpace => ast_generics.ty_params[index].ident.name,
TypeSpace => ast_generics.ty_params[index].name,
SelfSpace => special_idents::type_self.name,
FnSpace => self.tcx().sess.bug("Fn space occupied?"),
};
@@ -149,7 +149,7 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
if let Some(trait_ref) = self.crate_context.tcx.impl_trait_ref(impl_did) {
debug!("(checking implementation) adding impl for trait '{:?}', item '{}'",
trait_ref,
item.ident);
item.name);

enforce_trait_manually_implementable(self.crate_context.tcx,
item.span,
@@ -577,7 +577,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
container: ImplOrTraitItemContainer,
sig: &hir::MethodSig,
id: ast::NodeId,
ident: ast::Ident,
name: ast::Name,
vis: hir::Visibility,
untransformed_rcvr_ty: Ty<'tcx>,
rcvr_ty_generics: &ty::Generics<'tcx>,
@@ -592,7 +592,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
sig, untransformed_rcvr_ty);

let def_id = DefId::local(id);
let ty_method = ty::Method::new(ident.name,
let ty_method = ty::Method::new(name,
ty_generics,
ty_generic_predicates,
fty,
@@ -605,7 +605,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
let fty = ccx.tcx.mk_fn(Some(def_id),
ccx.tcx.mk_bare_fn(ty_method.fty.clone()));
debug!("method {} (id {}) has type {:?}",
ident, id, fty);
name, id, fty);
ccx.tcx.register_item_type(def_id, TypeScheme {
generics: ty_method.generics.clone(),
ty: fty
@@ -643,7 +643,7 @@ fn convert_field<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,

fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
container: ImplOrTraitItemContainer,
ident: ast::Ident,
name: ast::Name,
id: ast::NodeId,
vis: hir::Visibility,
ty: ty::Ty<'tcx>,
@@ -656,7 +656,7 @@ fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
let default_id = default.map(|expr| DefId::local(expr.id));

let associated_const = Rc::new(ty::AssociatedConst {
name: ident.name,
name: name,
vis: vis,
def_id: DefId::local(id),
container: container,
@@ -669,13 +669,13 @@ fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,

fn convert_associated_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
container: ImplOrTraitItemContainer,
ident: ast::Ident,
name: ast::Name,
id: ast::NodeId,
vis: hir::Visibility,
ty: Option<Ty<'tcx>>)
{
let associated_type = Rc::new(ty::AssociatedType {
name: ident.name,
name: name,
vis: vis,
ty: ty,
def_id: DefId::local(id),
@@ -691,7 +691,7 @@ fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>,
untransformed_rcvr_ty: Ty<'tcx>,
rcvr_ty_generics: &ty::Generics<'tcx>,
rcvr_ty_predicates: &ty::GenericPredicates<'tcx>)
where I: Iterator<Item=(&'i hir::MethodSig, ast::NodeId, ast::Ident, hir::Visibility, Span)>
where I: Iterator<Item=(&'i hir::MethodSig, ast::NodeId, ast::Name, hir::Visibility, Span)>
{
debug!("convert_methods(untransformed_rcvr_ty={:?}, rcvr_ty_generics={:?}, \
rcvr_ty_predicates={:?})",
@@ -743,7 +743,7 @@ fn ensure_no_ty_param_bounds(ccx: &CrateCtxt,

fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
let tcx = ccx.tcx;
debug!("convert: item {} with id {}", it.ident, it.id);
debug!("convert: item {} with id {}", it.name, it.id);
match it.node {
// These don't define types.
hir::ItemExternCrate(_) | hir::ItemUse(_) |
@@ -823,7 +823,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
hir::TypeImplItem(_) => &mut seen_type_items,
_ => &mut seen_value_items,
};
if !seen_items.insert(impl_item.ident.name) {
if !seen_items.insert(impl_item.name) {
let desc = match impl_item.node {
hir::ConstImplItem(_, _) => "associated constant",
hir::TypeImplItem(_) => "associated type",
@@ -846,7 +846,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
ty: ty,
});
convert_associated_const(ccx, ImplContainer(DefId::local(it.id)),
impl_item.ident, impl_item.id,
impl_item.name, impl_item.id,
impl_item.vis.inherit_from(parent_visibility),
ty, Some(&*expr));
}
@@ -863,7 +863,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
let typ = ccx.icx(&ty_predicates).to_ty(&ExplicitRscope, ty);

convert_associated_type(ccx, ImplContainer(DefId::local(it.id)),
impl_item.ident, impl_item.id, impl_item.vis,
impl_item.name, impl_item.id, impl_item.vis,
Some(typ));
}
}
@@ -875,7 +875,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
// { fn foo(); }` is public, but private in `impl { fn
// foo(); }`).
let method_vis = ii.vis.inherit_from(parent_visibility);
Some((sig, ii.id, ii.ident, method_vis, ii.span))
Some((sig, ii.id, ii.name, method_vis, ii.span))
} else {
None
}
@@ -925,7 +925,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
ty: ty,
});
convert_associated_const(ccx, TraitContainer(DefId::local(it.id)),
trait_item.ident, trait_item.id,
trait_item.name, trait_item.id,
hir::Public, ty, default.as_ref().map(|d| &**d));
}
_ => {}
@@ -941,7 +941,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
});

convert_associated_type(ccx, TraitContainer(DefId::local(it.id)),
trait_item.ident, trait_item.id, hir::Public,
trait_item.name, trait_item.id, hir::Public,
typ);
}
_ => {}
@@ -953,7 +953,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
hir::MethodTraitItem(ref sig, _) => sig,
_ => return None,
};
Some((sig, ti.id, ti.ident, hir::Inherited, ti.span))
Some((sig, ti.id, ti.name, hir::Inherited, ti.span))
});

// Run convert_methods on the trait methods.
@@ -1099,18 +1099,18 @@ fn convert_struct_variant<'tcx>(tcx: &ty::ctxt<'tcx>,
let fields = def.fields.iter().map(|f| {
let fid = DefId::local(f.node.id);
match f.node.kind {
hir::NamedField(ident, vis) => {
let dup_span = seen_fields.get(&ident.name).cloned();
hir::NamedField(name, vis) => {
let dup_span = seen_fields.get(&name).cloned();
if let Some(prev_span) = dup_span {
span_err!(tcx.sess, f.span, E0124,
"field `{}` is already declared",
ident.name);
name);
span_note!(tcx.sess, prev_span, "previously declared here");
} else {
seen_fields.insert(ident.name, f.span);
seen_fields.insert(name, f.span);
}

ty::FieldDefData::new(fid, ident.name, vis)
ty::FieldDefData::new(fid, name, vis)
},
hir::UnnamedField(vis) => {
ty::FieldDefData::new(fid, special_idents::unnamed_field.name, vis)
@@ -1135,7 +1135,7 @@ fn convert_struct_def<'tcx>(tcx: &ty::ctxt<'tcx>,
tcx.intern_adt_def(
did,
ty::AdtKind::Struct,
vec![convert_struct_variant(tcx, did, it.ident.name, 0, def)]
vec![convert_struct_variant(tcx, did, it.name, 0, def)]
)
}

@@ -1195,7 +1195,7 @@ fn convert_enum_def<'tcx>(tcx: &ty::ctxt<'tcx>,
if let Some(prev_disr_val) = prev_disr_val {
let result = repr_type.disr_incr(prev_disr_val);
if let None = result {
report_discrim_overflow(tcx, v.span, &v.node.name.name.as_str(),
report_discrim_overflow(tcx, v.span, &v.node.name.as_str(),
repr_type, prev_disr_val);
}
result
@@ -1209,7 +1209,7 @@ fn convert_enum_def<'tcx>(tcx: &ty::ctxt<'tcx>,
-> ty::VariantDefData<'tcx, 'tcx>
{
let did = DefId::local(v.node.id);
let name = v.node.name.name;
let name = v.node.name;
match v.node.kind {
hir::TupleVariantKind(ref va) => {
ty::VariantDefData {
@@ -1369,7 +1369,7 @@ fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,

let associated_type_names: Vec<_> = items.iter().filter_map(|trait_item| {
match trait_item.node {
hir::TypeTraitItem(..) => Some(trait_item.ident.name),
hir::TypeTraitItem(..) => Some(trait_item.name),
_ => None,
}
}).collect();
@@ -1417,7 +1417,7 @@ fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
.iter()
.enumerate()
.map(|(i, def)| tcx.mk_param(TypeSpace,
i as u32, def.ident.name))
i as u32, def.name))
.collect();

// ...and also create the `Self` parameter.
@@ -1444,7 +1444,7 @@ fn trait_defines_associated_type_named(ccx: &CrateCtxt,

trait_items.iter().any(|trait_item| {
match trait_item.node {
hir::TypeTraitItem(..) => trait_item.ident.name == assoc_name,
hir::TypeTraitItem(..) => trait_item.name == assoc_name,
_ => false,
}
})
@@ -1511,7 +1511,7 @@ fn convert_trait_predicates<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::Item)
};

let assoc_ty = ccx.tcx.mk_projection(self_trait_ref,
trait_item.ident.name);
trait_item.name);

let bounds = compute_bounds(&ccx.icx(&(ast_generics, trait_predicates)),
assoc_ty,
@@ -1862,7 +1862,7 @@ fn ty_generic_predicates<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
// type parameter (e.g., `<T:Foo>`).
for (index, param) in ast_generics.ty_params.iter().enumerate() {
let index = index as u32;
let param_ty = ty::ParamTy::new(space, index, param.ident.name).to_ty(ccx.tcx);
let param_ty = ty::ParamTy::new(space, index, param.name).to_ty(ccx.tcx);
let bounds = compute_bounds(&ccx.icx(&(base_predicates, ast_generics)),
param_ty,
&param.bounds,
@@ -2033,7 +2033,7 @@ fn get_or_create_type_parameter_def<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
let def = ty::TypeParameterDef {
space: space,
index: index,
name: param.ident.name,
name: param.name,
def_id: DefId::local(param.id),
default_def_id: DefId::local(parent),
default: default,
@@ -2415,7 +2415,7 @@ fn enforce_impl_params_are_constrained<'tcx>(tcx: &ty::ctxt<'tcx>,
for (index, ty_param) in ast_generics.ty_params.iter().enumerate() {
let param_ty = ty::ParamTy { space: TypeSpace,
idx: index as u32,
name: ty_param.ident.name };
name: ty_param.name };
if !input_parameters.contains(&ctp::Parameter::Type(param_ty)) {
report_unused_parameter(tcx, ty_param.span, "type", &param_ty.to_string());
}
@@ -43,7 +43,7 @@ use super::{Clean, ToSource};
///
/// The returned value is `None` if the `id` could not be inlined, and `Some`
/// of a vector of items if it was successfully expanded.
pub fn try_inline(cx: &DocContext, id: ast::NodeId, into: Option<ast::Ident>)
pub fn try_inline(cx: &DocContext, id: ast::NodeId, into: Option<ast::Name>)
-> Option<Vec<clean::Item>> {
let tcx = match cx.tcx_opt() {
Some(tcx) => tcx,
@@ -494,7 +494,7 @@ pub struct TyParam {
impl Clean<TyParam> for hir::TyParam {
fn clean(&self, cx: &DocContext) -> TyParam {
TyParam {
name: self.ident.clean(cx),
name: self.name.clean(cx),
did: DefId { krate: LOCAL_CRATE, node: self.id },
bounds: self.bounds.clean(cx),
default: self.default.clean(cx),
@@ -1257,7 +1257,7 @@ impl Clean<Item> for hir::TraitItem {
}
};
Item {
name: Some(self.ident.clean(cx)),
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
def_id: DefId::local(self.id),
@@ -1290,7 +1290,7 @@ impl Clean<Item> for hir::ImplItem {
}, true),
};
Item {
name: Some(self.ident.clean(cx)),
name: Some(self.name.clean(cx)),
source: self.span.clean(cx),
attrs: self.attrs.clean(cx),
def_id: DefId::local(self.id),
@@ -2386,14 +2386,14 @@ impl Clean<Vec<Item>> for doctree::Import {
(ret, ImportList(resolve_use_source(cx, p.clean(cx), self.id),
remaining))
}
hir::ViewPathSimple(i, ref p) => {
hir::ViewPathSimple(name, ref p) => {
if !denied {
match inline::try_inline(cx, self.id, Some(i)) {
match inline::try_inline(cx, self.id, Some(name)) {
Some(items) => return items,
None => {}
}
}
(vec![], SimpleImport(i.clean(cx),
(vec![], SimpleImport(name.clean(cx),
resolve_use_source(cx, p.clean(cx), self.id)))
}
};
@@ -2484,7 +2484,7 @@ impl Clean<Item> for hir::ForeignItem {
}
};
Item {
name: Some(self.ident.clean(cx)),
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
def_id: DefId::local(self.id),
@@ -2547,7 +2547,7 @@ fn name_from_pat(p: &hir::Pat) -> String {
PatStruct(ref name, ref fields, etc) => {
format!("{} {{ {}{} }}", path_to_string(name),
fields.iter().map(|&Spanned { node: ref fp, .. }|
format!("{}: {}", fp.ident, name_from_pat(&*fp.pat)))
format!("{}: {}", fp.name, name_from_pat(&*fp.pat)))
.collect::<Vec<String>>().join(", "),
if etc { ", ..." } else { "" }
)
@@ -2840,7 +2840,7 @@ pub struct TypeBinding {
impl Clean<TypeBinding> for hir::TypeBinding {
fn clean(&self, cx: &DocContext) -> TypeBinding {
TypeBinding {
name: self.ident.clean(cx),
name: self.name.clean(cx),
ty: self.ty.clean(cx)
}
}
@@ -17,13 +17,13 @@ use syntax;
use syntax::codemap::Span;
use syntax::abi;
use syntax::ast;
use syntax::ast::{Ident, NodeId};
use syntax::ast::{Name, NodeId};
use syntax::attr;
use syntax::ptr::P;
use rustc_front::hir;

pub struct Module {
pub name: Option<Ident>,
pub name: Option<Name>,
pub attrs: Vec<ast::Attribute>,
pub where_outer: Span,
pub where_inner: Span,
@@ -48,7 +48,7 @@ pub struct Module {
}

impl Module {
pub fn new(name: Option<Ident>) -> Module {
pub fn new(name: Option<Name>) -> Module {
Module {
name : name,
id: 0,
@@ -98,7 +98,7 @@ pub struct Struct {
pub stab: Option<attr::Stability>,
pub id: NodeId,
pub struct_type: StructType,
pub name: Ident,
pub name: Name,
pub generics: hir::Generics,
pub attrs: Vec<ast::Attribute>,
pub fields: Vec<hir::StructField>,
@@ -113,11 +113,11 @@ pub struct Enum {
pub attrs: Vec<ast::Attribute>,
pub id: NodeId,
pub whence: Span,
pub name: Ident,
pub name: Name,
}

pub struct Variant {
pub name: Ident,
pub name: Name,
pub attrs: Vec<ast::Attribute>,
pub kind: hir::VariantKind,
pub id: ast::NodeId,
@@ -129,7 +129,7 @@ pub struct Function {
pub decl: hir::FnDecl,
pub attrs: Vec<ast::Attribute>,
pub id: NodeId,
pub name: Ident,
pub name: Name,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub unsafety: hir::Unsafety,
@@ -142,7 +142,7 @@ pub struct Function {
pub struct Typedef {
pub ty: P<hir::Ty>,
pub gen: hir::Generics,
pub name: Ident,
pub name: Name,
pub id: ast::NodeId,
pub attrs: Vec<ast::Attribute>,
pub whence: Span,
@@ -155,7 +155,7 @@ pub struct Static {
pub type_: P<hir::Ty>,
pub mutability: hir::Mutability,
pub expr: P<hir::Expr>,
pub name: Ident,
pub name: Name,
pub attrs: Vec<ast::Attribute>,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
@@ -166,7 +166,7 @@ pub struct Static {
pub struct Constant {
pub type_: P<hir::Ty>,
pub expr: P<hir::Expr>,
pub name: Ident,
pub name: Name,
pub attrs: Vec<ast::Attribute>,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
@@ -176,7 +176,7 @@ pub struct Constant {

pub struct Trait {
pub unsafety: hir::Unsafety,
pub name: Ident,
pub name: Name,
pub items: Vec<P<hir::TraitItem>>, //should be TraitItem
pub generics: hir::Generics,
pub bounds: Vec<hir::TyParamBound>,
@@ -210,16 +210,16 @@ pub struct DefaultImpl {
}

pub struct Macro {
pub name: Ident,
pub name: Name,
pub id: ast::NodeId,
pub attrs: Vec<ast::Attribute>,
pub whence: Span,
pub stab: Option<attr::Stability>,
pub imported_from: Option<Ident>,
pub imported_from: Option<Name>,
}

pub struct ExternCrate {
pub name: Ident,
pub name: Name,
pub path: Option<String>,
pub vis: hir::Visibility,
pub attrs: Vec<ast::Attribute>,
@@ -83,7 +83,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}

pub fn visit_struct_def(&mut self, item: &hir::Item,
name: ast::Ident, sd: &hir::StructDef,
name: ast::Name, sd: &hir::StructDef,
generics: &hir::Generics) -> Struct {
debug!("Visiting struct");
let struct_type = struct_type_from_def(&*sd);
@@ -101,7 +101,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}

pub fn visit_enum_def(&mut self, it: &hir::Item,
name: ast::Ident, def: &hir::EnumDef,
name: ast::Name, def: &hir::EnumDef,
params: &hir::Generics) -> Enum {
debug!("Visiting enum");
Enum {
@@ -124,7 +124,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}

pub fn visit_fn(&mut self, item: &hir::Item,
name: ast::Ident, fd: &hir::FnDecl,
name: ast::Name, fd: &hir::FnDecl,
unsafety: &hir::Unsafety,
constness: hir::Constness,
abi: &abi::Abi,
@@ -148,7 +148,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
pub fn visit_mod_contents(&mut self, span: Span, attrs: Vec<ast::Attribute> ,
vis: hir::Visibility, id: ast::NodeId,
m: &hir::Mod,
name: Option<ast::Ident>) -> Module {
name: Option<ast::Name>) -> Module {
let mut om = Module::new(name);
om.where_outer = span;
om.where_inner = m.inner;
@@ -199,7 +199,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {

}

fn resolve_id(&mut self, id: ast::NodeId, renamed: Option<ast::Ident>,
fn resolve_id(&mut self, id: ast::NodeId, renamed: Option<ast::Name>,
glob: bool, om: &mut Module, please_inline: bool) -> bool {
let tcx = match self.cx.tcx_opt() {
Some(tcx) => tcx,
@@ -241,9 +241,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}

pub fn visit_item(&mut self, item: &hir::Item,
renamed: Option<ast::Ident>, om: &mut Module) {
renamed: Option<ast::Name>, om: &mut Module) {
debug!("Visiting item {:?}", item);
let name = renamed.unwrap_or(item.ident);
let name = renamed.unwrap_or(item.name);
match item.node {
hir::ItemExternCrate(ref p) => {
let path = match *p {
@@ -398,7 +398,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
Macro {
id: def.id,
attrs: def.attrs.clone(),
name: def.ident,
name: def.name,
whence: def.span,
stab: self.stability(def.id),
imported_from: def.imported_from,
@@ -151,8 +151,7 @@ pub const ILLEGAL_CTXT : SyntaxContext = 1;

/// A name is a part of an identifier, representing a string or gensym. It's
/// the result of interning.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash,
RustcEncodable, RustcDecodable, Clone, Copy)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Clone, Copy)]
pub struct Name(pub u32);

impl<T: AsRef<str>> PartialEq<T> for Name {
@@ -179,6 +178,18 @@ impl Name {
/// A mark represents a unique id associated with a macro expansion
pub type Mrk = u32;

impl Encodable for Name {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_str(&self.as_str())
}
}

impl Decodable for Name {
fn decode<D: Decoder>(d: &mut D) -> Result<Name, D::Error> {
Ok(token::intern(&try!(d.read_str())[..]))
}
}

impl Encodable for Ident {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_str(&self.name.as_str())
@@ -37,7 +37,7 @@ impl LintPass for Pass {

impl LateLintPass for Pass {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match &*it.ident.name.as_str() {
match &*it.name.as_str() {
"lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
"pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
_ => {}