diff --git a/src/librustc/front/map/mod.rs b/src/librustc/front/map/mod.rs index dd420ae2884..74fb1ce18b3 100644 --- a/src/librustc/front/map/mod.rs +++ b/src/librustc/front/map/mod.rs @@ -483,7 +483,7 @@ impl<'ast> Map<'ast> { NodeForeignItem(i) => PathName(i.name), NodeImplItem(ii) => PathName(ii.name), NodeTraitItem(ti) => PathName(ti.name), - NodeVariant(v) => PathName(v.node.name.name), + NodeVariant(v) => PathName(v.node.name), NodeLifetime(lt) => PathName(lt.name), _ => panic!("no path elem for {:?}", node) } @@ -710,7 +710,7 @@ impl Named for Spanned { fn name(&self) -> Name { self.node.name() } impl Named for Item { fn name(&self) -> Name { self.name } } impl Named for ForeignItem { fn name(&self) -> Name { self.name } } -impl Named for Variant_ { fn name(&self) -> Name { self.name.name } } +impl Named for Variant_ { fn name(&self) -> Name { self.name } } impl Named for TraitItem { fn name(&self) -> Name { self.name } } impl Named for ImplItem { fn name(&self) -> Name { self.name } } diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 85abfc16628..40d7b63cff9 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -526,7 +526,7 @@ fn construct_witness<'a,'tcx>(cx: &MatchCheckCtxt<'a,'tcx>, ctor: &Constructor, .map(|(field, pat)| Spanned { span: DUMMY_SP, node: hir::FieldPat { - ident: ast::Ident::new(field.name), + name: field.name, pat: pat, is_shorthand: false, } @@ -910,7 +910,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat], let def_variant = adt.variant_of_def(def); if variant.did == def_variant.did { Some(variant.fields.iter().map(|sf| { - match pattern_fields.iter().find(|f| f.node.ident.name == sf.name) { + match pattern_fields.iter().find(|f| f.node.name == sf.name) { Some(ref f) => &*f.node.pat, _ => DUMMY_WILD_PAT } diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 9e7ef0187c2..4894a78f1ac 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -314,7 +314,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P let field_pats = fields.iter().map(|field| codemap::Spanned { span: codemap::DUMMY_SP, node: hir::FieldPat { - ident: ast::Ident::new(field.name.node), + name: field.name.node, pat: const_expr_to_pat(tcx, &*field.expr, span), is_shorthand: false, }, diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index b234a6166a4..92592f049e0 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -137,7 +137,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { if let hir::PatWild(hir::PatWildSingle) = pat.node.pat.node { continue; } - self.live_symbols.insert(variant.field_named(pat.node.ident.name).did.node); + self.live_symbols.insert(variant.field_named(pat.node.name).did.node); } } @@ -443,7 +443,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { } fn should_warn_about_field(&mut self, node: &hir::StructField_) -> bool { - let is_named = node.ident().is_some(); + let is_named = node.name().is_some(); let field_type = self.tcx.node_id_to_type(node.id); let is_marker_field = match field_type.ty_to_def_id() { Some(def_id) => self.tcx.lang_items.items().any(|(_, item)| *item == Some(def_id)), @@ -529,7 +529,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> { for variant in &enum_def.variants { if self.should_warn_about_variant(&variant.node) { self.warn_dead_code(variant.node.id, variant.span, - variant.node.name.name, "variant"); + variant.node.name, "variant"); } } }, @@ -549,7 +549,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> { fn visit_struct_field(&mut self, field: &hir::StructField) { if self.should_warn_about_field(&field.node) { self.warn_dead_code(field.node.id, field.span, - field.node.ident().unwrap().name, "struct field"); + field.node.name().unwrap(), "struct field"); } visit::walk_struct_field(self, field); diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index 2b2f4e6d84e..fa2856e2f30 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1198,7 +1198,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> { lifetime, region_names); hir::TyParam { - ident: ty_param.ident, + name: ty_param.name, id: ty_param.id, bounds: bounds, default: ty_param.default.clone(), @@ -1541,7 +1541,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> { let new_bindings = data.bindings.map(|b| { P(hir::TypeBinding { id: b.id, - ident: b.ident, + name: b.name, ty: self.rebuild_arg_ty_or_output(&*b.ty, lifetime, anon_nums, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index f3629c66416..2e7d9e89824 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1272,7 +1272,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> { // {f1: p1, ..., fN: pN} for fp in field_pats { let field_ty = try!(self.pat_ty(&*fp.node.pat)); // see (*2) - let cmt_field = self.cat_field(pat, cmt.clone(), fp.node.ident.name, field_ty); + let cmt_field = self.cat_field(pat, cmt.clone(), fp.node.name, field_ty); try!(self.cat_pattern_(cmt_field, &*fp.node.pat, op)); } } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 6ff6e8e3d0f..bc83f42b908 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -513,7 +513,7 @@ pub fn check_pat(tcx: &ty::ctxt, pat: &hir::Pat, // Foo { a, b, c } hir::PatStruct(_, ref pat_fields, _) => { for field in pat_fields { - let did = v.field_named(field.node.ident.name).did; + let did = v.field_named(field.node.name).did; maybe_do_stability_check(tcx, did, field.span, cb); } } diff --git a/src/librustc_front/fold.rs b/src/librustc_front/fold.rs index e0e4539872e..b305114ced7 100644 --- a/src/librustc_front/fold.rs +++ b/src/librustc_front/fold.rs @@ -355,9 +355,9 @@ pub fn noop_fold_decl(d: P, fld: &mut T) -> SmallVector } pub fn noop_fold_ty_binding(b: P, fld: &mut T) -> P { - b.map(|TypeBinding { id, ident, ty, span }| TypeBinding { + b.map(|TypeBinding { id, name, ty, span }| TypeBinding { id: fld.new_id(id), - ident: ident, + name: name, ty: fld.fold_ty(ty), span: fld.new_span(span), }) @@ -576,10 +576,10 @@ pub fn noop_fold_ty_param_bound(tpb: TyParamBound, fld: &mut T) } pub fn noop_fold_ty_param(tp: TyParam, fld: &mut T) -> TyParam { - let TyParam {id, ident, bounds, default, span} = tp; + let TyParam {id, name, bounds, default, span} = tp; TyParam { id: fld.new_id(id), - ident: ident, + name: name, bounds: fld.fold_bounds(bounds), default: default.map(|x| fld.fold_ty(x)), span: span @@ -1009,7 +1009,7 @@ pub fn noop_fold_pat(p: P, folder: &mut T) -> P { let fs = fields.move_map(|f| { Spanned { span: folder.new_span(f.span), node: hir::FieldPat { - ident: f.node.ident, + name: f.node.name, pat: folder.fold_pat(f.node.pat), is_shorthand: f.node.is_shorthand, }} diff --git a/src/librustc_front/hir.rs b/src/librustc_front/hir.rs index 8d0ba4fc483..4dfb80cce6d 100644 --- a/src/librustc_front/hir.rs +++ b/src/librustc_front/hir.rs @@ -244,7 +244,7 @@ pub type TyParamBounds = OwnedSlice; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TyParam { - pub ident: Ident, + pub name: Name, pub id: NodeId, pub bounds: TyParamBounds, pub default: Option>, @@ -378,7 +378,7 @@ impl fmt::Debug for Pat { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct FieldPat { /// The identifier for the field - pub ident: Ident, + pub name: Name, /// The pattern the field is destructured to pub pat: P, pub is_shorthand: bool, @@ -791,7 +791,7 @@ pub enum ImplItem_ { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TypeBinding { pub id: NodeId, - pub ident: Ident, + pub name: Name, pub ty: P, pub span: Span, } @@ -981,11 +981,11 @@ pub enum ExplicitSelf_ { /// No self SelfStatic, /// `self` - SelfValue(Ident), + SelfValue(Name), /// `&'lt self`, `&'lt mut self` - SelfRegion(Option, Mutability, Ident), + SelfRegion(Option, Mutability, Name), /// `self: TYPE` - SelfExplicit(P, Ident), + SelfExplicit(P, Name), } pub type ExplicitSelf = Spanned; @@ -1026,7 +1026,7 @@ pub struct EnumDef { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Variant_ { - pub name: Ident, + pub name: Name, pub attrs: Vec, pub kind: VariantKind, pub id: NodeId, @@ -1133,9 +1133,9 @@ pub struct StructField_ { } impl StructField_ { - pub fn ident(&self) -> Option { + pub fn name(&self) -> Option { match self.kind { - NamedField(ref ident, _) => Some(ident.clone()), + NamedField(name, _) => Some(name), UnnamedField(_) => None } } @@ -1145,7 +1145,7 @@ pub type StructField = Spanned; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum StructFieldKind { - NamedField(Ident, Visibility), + NamedField(Name, Visibility), /// Element of a tuple-like struct UnnamedField(Visibility), } diff --git a/src/librustc_front/lowering.rs b/src/librustc_front/lowering.rs index 8735f7cf8c6..4888ff93c99 100644 --- a/src/librustc_front/lowering.rs +++ b/src/librustc_front/lowering.rs @@ -76,7 +76,7 @@ pub fn lower_decl(d: &Decl) -> P { } pub fn lower_ty_binding(b: &TypeBinding) -> P { - P(hir::TypeBinding { id: b.id, ident: b.ident, ty: lower_ty(&b.ty), span: b.span }) + P(hir::TypeBinding { id: b.id, name: b.ident.name, ty: lower_ty(&b.ty), span: b.span }) } pub fn lower_ty(t: &Ty) -> P { @@ -138,7 +138,7 @@ pub fn lower_variant(v: &Variant) -> P { P(Spanned { node: hir::Variant_ { id: v.node.id, - name: v.node.name, + name: v.node.name.name, attrs: v.node.attrs.clone(), kind: match v.node.kind { TupleVariantKind(ref variant_args) => { @@ -209,12 +209,12 @@ pub fn lower_local(l: &Local) -> P { pub fn lower_explicit_self_underscore(es: &ExplicitSelf_) -> hir::ExplicitSelf_ { match *es { SelfStatic => hir::SelfStatic, - SelfValue(v) => hir::SelfValue(v), + SelfValue(v) => hir::SelfValue(v.name), SelfRegion(ref lifetime, m, ident) => { - hir::SelfRegion(lower_opt_lifetime(lifetime), lower_mutability(m), ident) + hir::SelfRegion(lower_opt_lifetime(lifetime), lower_mutability(m), ident.name) } SelfExplicit(ref typ, ident) => { - hir::SelfExplicit(lower_ty(typ), ident) + hir::SelfExplicit(lower_ty(typ), ident.name) } } } @@ -258,7 +258,7 @@ pub fn lower_ty_param_bound(tpb: &TyParamBound) -> hir::TyParamBound { pub fn lower_ty_param(tp: &TyParam) -> hir::TyParam { hir::TyParam { id: tp.id, - ident: tp.ident, + name: tp.ident.name, bounds: lower_bounds(&tp.bounds), default: tp.default.as_ref().map(|x| lower_ty(x)), span: tp.span, @@ -665,7 +665,7 @@ pub fn lower_pat(p: &Pat) -> P { let fs = fields.iter().map(|f| { Spanned { span: f.span, node: hir::FieldPat { - ident: f.node.ident, + name: f.node.ident.name, pat: lower_pat(&f.node.pat), is_shorthand: f.node.is_shorthand, }} @@ -901,7 +901,7 @@ pub fn lower_binding_mode(b: &BindingMode) -> hir::BindingMode { pub fn lower_struct_field_kind(s: &StructFieldKind) -> hir::StructFieldKind { match *s { - NamedField(ident, vis) => hir::NamedField(ident, lower_visibility(vis)), + NamedField(ident, vis) => hir::NamedField(ident.name, lower_visibility(vis)), UnnamedField(vis) => hir::UnnamedField(lower_visibility(vis)), } } diff --git a/src/librustc_front/print/pprust.rs b/src/librustc_front/print/pprust.rs index 0a56bcceb43..6f2ef8e8cbc 100644 --- a/src/librustc_front/print/pprust.rs +++ b/src/librustc_front/print/pprust.rs @@ -926,12 +926,12 @@ impl<'a> State<'a> { for field in &struct_def.fields { match field.node.kind { hir::UnnamedField(..) => panic!("unexpected unnamed field"), - hir::NamedField(ident, visibility) => { + hir::NamedField(name, visibility) => { try!(self.hardbreak_if_not_bol()); try!(self.maybe_print_comment(field.span.lo)); try!(self.print_outer_attributes(&field.node.attrs)); try!(self.print_visibility(visibility)); - try!(self.print_ident(ident)); + try!(self.print_name(name)); try!(self.word_nbsp(":")); try!(self.print_type(&*field.node.ty)); try!(word(&mut self.s, ",")); @@ -946,7 +946,7 @@ impl<'a> State<'a> { pub fn print_variant(&mut self, v: &hir::Variant) -> io::Result<()> { match v.node.kind { hir::TupleVariantKind(ref args) => { - try!(self.print_ident(v.node.name)); + try!(self.print_name(v.node.name)); if !args.is_empty() { try!(self.popen()); try!(self.commasep(Consistent, @@ -958,7 +958,7 @@ impl<'a> State<'a> { hir::StructVariantKind(ref struct_def) => { try!(self.head("")); let generics = ::util::empty_generics(); - try!(self.print_struct(&**struct_def, &generics, v.node.name.name, v.span)); + try!(self.print_struct(&**struct_def, &generics, v.node.name, v.span)); } } match v.node.disr_expr { @@ -1699,7 +1699,7 @@ impl<'a> State<'a> { if comma { try!(self.word_space(",")) } - try!(self.print_ident(binding.ident)); + try!(self.print_name(binding.name)); try!(space(&mut self.s)); try!(self.word_space("=")); try!(self.print_type(&*binding.ty)); @@ -1785,7 +1785,7 @@ impl<'a> State<'a> { |s, f| { try!(s.cbox(indent_unit)); if !f.node.is_shorthand { - try!(s.print_ident(f.node.ident)); + try!(s.print_name(f.node.name)); try!(s.word_nbsp(":")); } try!(s.print_pat(&*f.node.pat)); @@ -2111,7 +2111,7 @@ impl<'a> State<'a> { } pub fn print_ty_param(&mut self, param: &hir::TyParam) -> io::Result<()> { - try!(self.print_ident(param.ident)); + try!(self.print_name(param.name)); try!(self.print_bounds(":", ¶m.bounds)); match param.default { Some(ref default) => { diff --git a/src/librustc_front/visit.rs b/src/librustc_front/visit.rs index 9f254b6840c..a167e962db0 100644 --- a/src/librustc_front/visit.rs +++ b/src/librustc_front/visit.rs @@ -299,7 +299,7 @@ pub fn walk_enum_def<'v, V: Visitor<'v>>(visitor: &mut V, pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, variant: &'v Variant, generics: &'v Generics) { - visitor.visit_name(variant.span, variant.node.name.name); + visitor.visit_name(variant.span, variant.node.name); match variant.node.kind { TupleVariantKind(ref variant_arguments) => { @@ -309,7 +309,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, } StructVariantKind(ref struct_definition) => { visitor.visit_struct_def(&**struct_definition, - variant.node.name.name, + variant.node.name, generics, variant.node.id) } @@ -441,7 +441,7 @@ pub fn walk_path_parameters<'v, V: Visitor<'v>>(visitor: &mut V, pub fn walk_assoc_type_binding<'v, V: Visitor<'v>>(visitor: &mut V, type_binding: &'v TypeBinding) { - visitor.visit_name(type_binding.span, type_binding.ident.name); + visitor.visit_name(type_binding.span, type_binding.name); visitor.visit_ty(&*type_binding.ty); } @@ -539,7 +539,7 @@ pub fn walk_ty_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics) { for param in generics.ty_params.iter() { - visitor.visit_name(param.span, param.ident.name); + visitor.visit_name(param.span, param.name); walk_ty_param_bounds_helper(visitor, ¶m.bounds); walk_ty_opt(visitor, ¶m.default); } @@ -668,7 +668,7 @@ pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V, pub fn walk_struct_field<'v, V: Visitor<'v>>(visitor: &mut V, struct_field: &'v StructField) { if let NamedField(name, _) = struct_field.node.kind { - visitor.visit_name(struct_field.span, name.name); + visitor.visit_name(struct_field.span, name); } visitor.visit_ty(&*struct_field.node.ty); diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index d2b3f6fc3cc..d115c60f33c 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -909,7 +909,7 @@ impl LateLintPass for NonShorthandFieldPatterns { }); for fieldpat in field_pats { if let hir::PatIdent(_, ident, None) = fieldpat.node.pat.node { - if ident.node.name == fieldpat.node.ident.name { + if ident.node.name == fieldpat.node.name { // FIXME: should this comparison really be done on the name? // doing it on the ident will fail during compilation of libcore cx.span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span, diff --git a/src/librustc_mir/tcx/pattern.rs b/src/librustc_mir/tcx/pattern.rs index eee0911f1cd..aeca15cb43c 100644 --- a/src/librustc_mir/tcx/pattern.rs +++ b/src/librustc_mir/tcx/pattern.rs @@ -268,7 +268,7 @@ impl<'a,'tcx:'a> Mirror> for PatNode<'tcx> { let subpatterns = fields.iter() .map(|field| FieldPatternRef { - field: Field::Named(field.node.ident.name), + field: Field::Named(field.node.name), pattern: self.pat_ref(&field.node.pat), }) .collect(); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index d077ee451fb..dc74ba0ff8a 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -941,7 +941,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> { let variant = adt.variant_of_def(def); for field in fields { self.check_field(pattern.span, adt, variant, - NamedField(field.node.ident.name)); + NamedField(field.node.name)); } } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 068b89b6ded..e3e1a26a6f6 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -508,7 +508,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { // Record the def ID and fields of this struct. let named_fields = struct_def.fields.iter().filter_map(|f| { match f.node.kind { - NamedField(ident, _) => Some(ident.name), + NamedField(name, _) => Some(name), UnnamedField(_) => None } }).collect(); @@ -578,7 +578,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { variant: &Variant, item_id: DefId, parent: &Rc) { - let name = variant.node.name.name; + let name = variant.node.name; let is_exported = match variant.node.kind { TupleVariantKind(_) => false, StructVariantKind(_) => { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 2cb1f6802f0..f3789c773fb 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -509,7 +509,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> { } hir::StructVariantKind(ref struct_definition) => { self.visit_struct_def(&**struct_definition, - variant.node.name.name, + variant.node.name, generics, variant.node.id); } @@ -2264,7 +2264,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let mut function_type_rib = Rib::new(rib_kind); let mut seen_bindings = HashSet::new(); for (index, type_parameter) in generics.ty_params.iter().enumerate() { - let name = type_parameter.ident.name; + let name = type_parameter.name; debug!("with_type_parameter_rib: {}", type_parameter.id); if seen_bindings.contains(&name) { @@ -2390,7 +2390,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { fn resolve_generics(&mut self, generics: &Generics) { for type_parameter in generics.ty_params.iter() { - self.check_if_primitive_type_name(type_parameter.ident.name, type_parameter.span); + self.check_if_primitive_type_name(type_parameter.name, type_parameter.span); } for predicate in &generics.where_clause.predicates { match predicate { diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index cccc610601c..af0780587e8 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -1872,7 +1872,7 @@ pub fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, let pat_repr = adt::represent_type(bcx.ccx(), pat_ty); let pat_v = VariantInfo::of_node(tcx, pat_ty, pat.id); for f in fields { - let name = f.node.ident.name; + let name = f.node.name; let fldptr = adt::trans_field_ptr( bcx, &*pat_repr, diff --git a/src/librustc_trans/trans/debuginfo/mod.rs b/src/librustc_trans/trans/debuginfo/mod.rs index c7bf7f67f7a..ebd2b7ea418 100644 --- a/src/librustc_trans/trans/debuginfo/mod.rs +++ b/src/librustc_trans/trans/debuginfo/mod.rs @@ -520,7 +520,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // Handle other generic parameters let actual_types = param_substs.types.get_slice(subst::FnSpace); - for (index, &hir::TyParam{ ident, .. }) in generics.ty_params.iter().enumerate() { + for (index, &hir::TyParam{ name, .. }) in generics.ty_params.iter().enumerate() { let actual_type = actual_types[index]; // Add actual type name to <...> clause of function name let actual_type_name = compute_debuginfo_type_name(cx, @@ -535,7 +535,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // Again, only create type information if full debuginfo is enabled if cx.sess().opts.debuginfo == FullDebugInfo { let actual_type_metadata = type_metadata(cx, actual_type, codemap::DUMMY_SP); - let name = CString::new(ident.name.as_str().as_bytes()).unwrap(); + let name = CString::new(name.as_str().as_bytes()).unwrap(); let param_metadata = unsafe { llvm::LLVMDIBuilderCreateTemplateTypeParameter( DIB(cx), diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs index 73784919c13..df0323350fd 100644 --- a/src/librustc_trans/trans/monomorphize.rs +++ b/src/librustc_trans/trans/monomorphize.rs @@ -194,7 +194,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, } hir_map::NodeVariant(v) => { let variant = inlined_variant_def(ccx, fn_id.node); - assert_eq!(v.node.name.name, variant.name); + assert_eq!(v.node.name, variant.name); let d = mk_lldecl(abi::Rust); attributes::inline(d, attributes::InlineAttr::Hint); trans_enum_variant(ccx, fn_id.node, variant.disr_val, psubsts, d); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 6f093cabac6..5be450ea278 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -545,7 +545,7 @@ fn convert_angle_bracketed_parameters<'tcx>(this: &AstConv<'tcx>, let assoc_bindings: Vec<_> = data.bindings.iter() - .map(|b| ConvertedBinding { item_name: b.ident.name, + .map(|b| ConvertedBinding { item_name: b.name, ty: ast_ty_to_ty(this, rscope, &*b.ty), span: b.span }) .collect(); diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 08cda74e317..136b3c4405d 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -706,25 +706,25 @@ pub fn check_struct_pat_fields<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, // Typecheck each field. for &Spanned { node: ref field, span } in fields { - let field_ty = match used_fields.entry(field.ident.name) { + let field_ty = match used_fields.entry(field.name) { Occupied(occupied) => { span_err!(tcx.sess, span, E0025, "field `{}` bound multiple times in the pattern", - field.ident); + field.name); span_note!(tcx.sess, *occupied.get(), "field `{}` previously bound here", - field.ident); + field.name); tcx.types.err } Vacant(vacant) => { vacant.insert(span); - field_map.get(&field.ident.name) + field_map.get(&field.name) .map(|f| pcx.fcx.field_ty(span, f, substs)) .unwrap_or_else(|| { span_err!(tcx.sess, span, E0026, "struct `{}` does not have a field named `{}`", tcx.item_path_str(variant.did), - field.ident); + field.name); tcx.types.err }) } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index ff7acbf741c..47ddbfdb8cc 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -838,7 +838,7 @@ 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 => { @@ -4938,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); } } } diff --git a/src/librustc_typeck/check/wf.rs b/src/librustc_typeck/check/wf.rs index 2c931e7830d..902ebcc3da8 100644 --- a/src/librustc_typeck/check/wf.rs +++ b/src/librustc_typeck/check/wf.rs @@ -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?"), }; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 06dd80c57ad..0e462b2a852 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -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?"), }; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 81c4732d20d..cd3c630c7ab 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -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) @@ -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 { @@ -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. @@ -1862,7 +1862,7 @@ fn ty_generic_predicates<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, // type parameter (e.g., ``). 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, ¶m.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", ¶m_ty.to_string()); } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index f9b5b570490..14d5ed2eb50 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -494,7 +494,7 @@ pub struct TyParam { impl Clean 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), @@ -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::>().join(", "), if etc { ", ..." } else { "" } ) @@ -2840,7 +2840,7 @@ pub struct TypeBinding { impl Clean 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) } } diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index be283c19cfa..c234ec01b88 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -17,7 +17,7 @@ use syntax; use syntax::codemap::Span; use syntax::abi; use syntax::ast; -use syntax::ast::{Ident, Name, NodeId}; +use syntax::ast::{Name, NodeId}; use syntax::attr; use syntax::ptr::P; use rustc_front::hir; @@ -117,7 +117,7 @@ pub struct Enum { } pub struct Variant { - pub name: Ident, + pub name: Name, pub attrs: Vec, pub kind: hir::VariantKind, pub id: ast::NodeId,