]> git.lizzy.rs Git - rust.git/commitdiff
Part of #6993. Moved a bunch of uses of Ident to Name
authorJonathan S <gereeter@gmail.com>
Wed, 1 Oct 2014 00:11:34 +0000 (19:11 -0500)
committerJonathan S <gereeter@gmail.com>
Thu, 23 Oct 2014 01:23:13 +0000 (20:23 -0500)
22 files changed:
src/librustc/metadata/csearch.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tyencode.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/resolve.rs
src/librustc/middle/save/mod.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/meth.rs
src/librustc/middle/ty.rs
src/librustc/middle/ty_fold.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/coherence/mod.rs
src/librustc/middle/typeck/collect.rs
src/librustc/util/ppaux.rs
src/librustdoc/clean/mod.rs

index 7ec74eb1c3faf2977c9cb5ae588c0ee61cd0e4b4..507aaf137cdf5c99f4145f7fa6a329e5a1eb4fed 100644 (file)
@@ -33,7 +33,7 @@
 use std::collections::hashmap::HashMap;
 
 pub struct StaticMethodInfo {
-    pub ident: ast::Ident,
+    pub name: ast::Name,
     pub def_id: ast::DefId,
     pub fn_style: ast::FnStyle,
     pub vis: ast::Visibility,
@@ -57,7 +57,7 @@ pub fn each_lang_item(cstore: &cstore::CStore,
 pub fn each_child_of_item(cstore: &cstore::CStore,
                           def_id: ast::DefId,
                           callback: |decoder::DefLike,
-                                     ast::Ident,
+                                     ast::Name,
                                      ast::Visibility|) {
     let crate_data = cstore.get_crate_data(def_id.krate);
     let get_crate_data: decoder::GetCrateDataCb = |cnum| {
@@ -74,7 +74,7 @@ pub fn each_child_of_item(cstore: &cstore::CStore,
 pub fn each_top_level_item_of_crate(cstore: &cstore::CStore,
                                     cnum: ast::CrateNum,
                                     callback: |decoder::DefLike,
-                                               ast::Ident,
+                                               ast::Name,
                                                ast::Visibility|) {
     let crate_data = cstore.get_crate_data(cnum);
     let get_crate_data: decoder::GetCrateDataCb = |cnum| {
@@ -139,7 +139,7 @@ pub fn get_impl_or_trait_item(tcx: &ty::ctxt, def: ast::DefId)
 }
 
 pub fn get_trait_item_name_and_kind(cstore: &cstore::CStore, def: ast::DefId)
-                                    -> (ast::Ident, resolve::TraitItemKind) {
+                                    -> (ast::Name, resolve::TraitItemKind) {
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_trait_item_name_and_kind(cstore.intr.clone(),
                                           &*cdata,
@@ -173,7 +173,7 @@ pub fn get_supertraits(tcx: &ty::ctxt, def: ast::DefId) -> Vec<Rc<ty::TraitRef>>
 }
 
 pub fn get_type_name_if_impl(cstore: &cstore::CStore, def: ast::DefId)
-                          -> Option<ast::Ident> {
+                          -> Option<ast::Name> {
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_type_name_if_impl(&*cdata, def.node)
 }
index 456cf93d9b5c50363ec52da3eacb3b4a6b042fa0..e1205ae1f767736036cc8d5aaba3f872dc379487 100644 (file)
@@ -292,12 +292,12 @@ fn item_path(item_doc: rbml::Doc) -> Vec<ast_map::PathElem> {
     result
 }
 
-fn item_name(intr: &IdentInterner, item: rbml::Doc) -> ast::Ident {
+fn item_name(intr: &IdentInterner, item: rbml::Doc) -> ast::Name {
     let name = reader::get_doc(item, tag_paths_data_name);
     let string = name.as_str_slice();
     match intr.find_equiv(&string) {
-        None => token::str_to_ident(string),
-        Some(val) => ast::Ident::new(val),
+        None => token::intern(string),
+        Some(val) => val,
     }
 }
 
@@ -457,7 +457,7 @@ fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
                                item_doc: rbml::Doc,
                                get_crate_data: GetCrateDataCb,
                                callback: |DefLike,
-                                          ast::Ident,
+                                          ast::Name,
                                           ast::Visibility|) {
     // Iterate over all children.
     let _ = reader::tagged_docs(item_doc, tag_mod_child, |child_info_doc| {
@@ -579,7 +579,7 @@ fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
                                                 child_def_id.krate);
                 // These items have a public visibility because they're part of
                 // a public re-export.
-                callback(def_like, token::str_to_ident(name), ast::Public);
+                callback(def_like, token::intern(name), ast::Public);
             }
         }
 
@@ -592,7 +592,7 @@ pub fn each_child_of_item(intr: Rc<IdentInterner>,
                           cdata: Cmd,
                           id: ast::NodeId,
                           get_crate_data: GetCrateDataCb,
-                          callback: |DefLike, ast::Ident, ast::Visibility|) {
+                          callback: |DefLike, ast::Name, ast::Visibility|) {
     // Find the item.
     let root_doc = rbml::Doc::new(cdata.data());
     let items = reader::get_doc(root_doc, tag_items);
@@ -613,7 +613,7 @@ pub fn each_top_level_item_of_crate(intr: Rc<IdentInterner>,
                                     cdata: Cmd,
                                     get_crate_data: GetCrateDataCb,
                                     callback: |DefLike,
-                                               ast::Ident,
+                                               ast::Name,
                                                ast::Visibility|) {
     let root_doc = rbml::Doc::new(cdata.data());
     let misc_info_doc = reader::get_doc(root_doc, tag_misc_info);
@@ -745,7 +745,7 @@ pub fn get_impl_items(cdata: Cmd, impl_id: ast::NodeId)
 pub fn get_trait_item_name_and_kind(intr: Rc<IdentInterner>,
                                     cdata: Cmd,
                                     id: ast::NodeId)
-                                    -> (ast::Ident, TraitItemKind) {
+                                    -> (ast::Name, TraitItemKind) {
     let doc = lookup_item(id, cdata.data());
     let name = item_name(&*intr, doc);
     match item_sort(doc) {
@@ -800,7 +800,7 @@ pub fn get_impl_or_trait_item(intr: Rc<IdentInterner>,
         }
         't' => {
             ty::TypeTraitItem(Rc::new(ty::AssociatedType {
-                ident: name,
+                name: name,
                 vis: vis,
                 def_id: def_id,
                 container: container,
@@ -885,7 +885,7 @@ pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
 }
 
 pub fn get_type_name_if_impl(cdata: Cmd,
-                             node_id: ast::NodeId) -> Option<ast::Ident> {
+                             node_id: ast::NodeId) -> Option<ast::Name> {
     let item = lookup_item(node_id, cdata.data());
     if item_family(item) != Impl {
         return None;
@@ -893,7 +893,7 @@ pub fn get_type_name_if_impl(cdata: Cmd,
 
     let mut ret = None;
     reader::tagged_docs(item, tag_item_impl_type_basename, |doc| {
-        ret = Some(token::str_to_ident(doc.as_str_slice()));
+        ret = Some(token::intern(doc.as_str_slice()));
         false
     });
 
@@ -936,7 +936,7 @@ pub fn get_static_methods_if_impl(intr: Rc<IdentInterner>,
                 }
 
                 static_impl_methods.push(StaticMethodInfo {
-                    ident: item_name(&*intr, impl_method_doc),
+                    name: item_name(&*intr, impl_method_doc),
                     def_id: item_def_id(impl_method_doc, cdata),
                     fn_style: fn_style,
                     vis: item_visibility(impl_method_doc),
@@ -1005,13 +1005,12 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
     reader::tagged_docs(item, tag_item_field, |an_item| {
         let f = item_family(an_item);
         if f == PublicField || f == InheritedField {
-            // FIXME #6993: name should be of type Name, not Ident
             let name = item_name(&*intr, an_item);
             let did = item_def_id(an_item, cdata);
             let tagdoc = reader::get_doc(an_item, tag_item_field_origin);
             let origin_id =  translate_def_id(cdata, reader::with_doc_data(tagdoc, parse_def_id));
             result.push(ty::field_ty {
-                name: name.name,
+                name: name,
                 id: did,
                 vis: struct_field_family_to_visibility(f),
                 origin: origin_id,
@@ -1393,7 +1392,7 @@ fn doc_generics(base_doc: rbml::Doc,
     reader::tagged_docs(doc, tag_region_param_def, |rp_doc| {
         let ident_str_doc = reader::get_doc(rp_doc,
                                             tag_region_param_def_ident);
-        let ident = item_name(&*token::get_ident_interner(), ident_str_doc);
+        let name = item_name(&*token::get_ident_interner(), ident_str_doc);
         let def_id_doc = reader::get_doc(rp_doc,
                                          tag_region_param_def_def_id);
         let def_id = reader::with_doc_data(def_id_doc, parse_def_id);
@@ -1414,7 +1413,7 @@ fn doc_generics(base_doc: rbml::Doc,
             true
         });
 
-        regions.push(space, ty::RegionParameterDef { name: ident.name,
+        regions.push(space, ty::RegionParameterDef { name: name,
                                                      def_id: def_id,
                                                      space: space,
                                                      index: index,
index 9106adcd3ef38c39f530385bea02484af5e298bf..6fe14a2d12ab50bf9e358abbf66d622c37995e84 100644 (file)
@@ -378,9 +378,9 @@ fn encode_path<PI: Iterator<PathElem> + Clone>(rbml_w: &mut Encoder,
 fn encode_reexported_static_method(rbml_w: &mut Encoder,
                                    exp: &middle::resolve::Export2,
                                    method_def_id: DefId,
-                                   method_ident: Ident) {
+                                   method_name: Name) {
     debug!("(encode reexported static method) {}::{}",
-            exp.name, token::get_ident(method_ident));
+            exp.name, token::get_name(method_name));
     rbml_w.start_tag(tag_items_data_item_reexport);
     rbml_w.start_tag(tag_items_data_item_reexport_def_id);
     rbml_w.wr_str(def_to_string(method_def_id).as_slice());
@@ -388,7 +388,7 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
     rbml_w.start_tag(tag_items_data_item_reexport_name);
     rbml_w.wr_str(format!("{}::{}",
                           exp.name,
-                          token::get_ident(method_ident)).as_slice());
+                          token::get_name(method_name)).as_slice());
     rbml_w.end_tag();
     rbml_w.end_tag();
 }
@@ -410,7 +410,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
                             encode_reexported_static_method(rbml_w,
                                                             exp,
                                                             m.def_id,
-                                                            m.ident);
+                                                            m.name);
                         }
                         ty::TypeTraitItem(_) => {}
                     }
@@ -435,7 +435,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
                         encode_reexported_static_method(rbml_w,
                                                         exp,
                                                         m.def_id,
-                                                        m.ident);
+                                                        m.name);
                     }
                     _ => {}
                 }
@@ -829,7 +829,7 @@ fn encode_method_ty_fields(ecx: &EncodeContext,
                            rbml_w: &mut Encoder,
                            method_ty: &ty::Method) {
     encode_def_id(rbml_w, method_ty.def_id);
-    encode_name(rbml_w, method_ty.ident.name);
+    encode_name(rbml_w, method_ty.name);
     encode_generics(rbml_w, ecx, &method_ty.generics,
                     tag_method_ty_generics);
     encode_method_fty(ecx, rbml_w, &method_ty.fty);
@@ -854,7 +854,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
                           ast_item_opt: Option<&ImplItem>) {
 
     debug!("encode_info_for_method: {} {}", m.def_id,
-           token::get_ident(m.ident));
+           token::get_name(m.name));
     rbml_w.start_tag(tag_items_data_item);
 
     encode_method_ty_fields(ecx, rbml_w, m);
@@ -868,7 +868,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
     let pty = lookup_item_type(ecx.tcx, m.def_id);
     encode_bounds_and_type(rbml_w, ecx, &pty);
 
-    let elem = ast_map::PathName(m.ident.name);
+    let elem = ast_map::PathName(m.name);
     encode_path(rbml_w, impl_path.chain(Some(elem).into_iter()));
     match ast_item_opt {
         Some(&ast::MethodImplItem(ref ast_method)) => {
@@ -897,12 +897,12 @@ fn encode_info_for_associated_type(ecx: &EncodeContext,
                                    typedef_opt: Option<P<ast::Typedef>>) {
     debug!("encode_info_for_associated_type({},{})",
            associated_type.def_id,
-           token::get_ident(associated_type.ident));
+           token::get_name(associated_type.name));
 
     rbml_w.start_tag(tag_items_data_item);
 
     encode_def_id(rbml_w, associated_type.def_id);
-    encode_name(rbml_w, associated_type.ident.name);
+    encode_name(rbml_w, associated_type.name);
     encode_visibility(rbml_w, associated_type.vis);
     encode_family(rbml_w, 'y');
     encode_parent_item(rbml_w, local_def(parent_id));
@@ -911,7 +911,7 @@ fn encode_info_for_associated_type(ecx: &EncodeContext,
     let stab = stability::lookup(ecx.tcx, associated_type.def_id);
     encode_stability(rbml_w, stab);
 
-    let elem = ast_map::PathName(associated_type.ident.name);
+    let elem = ast_map::PathName(associated_type.name);
     encode_path(rbml_w, impl_path.chain(Some(elem).into_iter()));
 
     match typedef_opt {
@@ -1395,7 +1395,7 @@ fn add_to_index(item: &Item, rbml_w: &Encoder,
 
                     encode_method_ty_fields(ecx, rbml_w, &*method_ty);
 
-                    let elem = ast_map::PathName(method_ty.ident.name);
+                    let elem = ast_map::PathName(method_ty.name);
                     encode_path(rbml_w,
                                 path.clone().chain(Some(elem).into_iter()));
 
@@ -1419,7 +1419,7 @@ fn add_to_index(item: &Item, rbml_w: &Encoder,
                         ty::StaticExplicitSelfCategory;
                 }
                 ty::TypeTraitItem(associated_type) => {
-                    let elem = ast_map::PathName(associated_type.ident.name);
+                    let elem = ast_map::PathName(associated_type.name);
                     encode_path(rbml_w,
                                 path.clone().chain(Some(elem).into_iter()));
 
index 6fbdceea37f9dd55fe75c8775b17bfc38bcd8add..0e57341a559ff6888d507a232207125e34965290 100644 (file)
@@ -96,13 +96,17 @@ fn scan<R>(st: &mut PState, is_last: |char| -> bool, op: |&[u8]| -> R) -> R {
 }
 
 pub fn parse_ident(st: &mut PState, last: char) -> ast::Ident {
+    ast::Ident::new(parse_name(st, last))
+}
+
+pub fn parse_name(st: &mut PState, last: char) -> ast::Name {
     fn is_last(b: char, c: char) -> bool { return c == b; }
-    return parse_ident_(st, |a| is_last(last, a) );
+    parse_name_(st, |a| is_last(last, a) )
 }
 
-fn parse_ident_(st: &mut PState, is_last: |char| -> bool) -> ast::Ident {
+fn parse_name_(st: &mut PState, is_last: |char| -> bool) -> ast::Name {
     scan(st, is_last, |bytes| {
-        token::str_to_ident(str::from_utf8(bytes).unwrap())
+        token::intern(str::from_utf8(bytes).unwrap())
     })
 }
 
@@ -625,7 +629,7 @@ pub fn parse_type_param_def_data(data: &[u8], start: uint,
 }
 
 fn parse_type_param_def(st: &mut PState, conv: conv_did) -> ty::TypeParameterDef {
-    let ident = parse_ident(st, ':');
+    let name = parse_name(st, ':');
     let def_id = parse_def(st, NominalType, |x,y| conv(x,y));
     let space = parse_param_space(st);
     assert_eq!(next(st), '|');
@@ -639,7 +643,7 @@ fn parse_type_param_def(st: &mut PState, conv: conv_did) -> ty::TypeParameterDef
     let default = parse_opt(st, |st| parse_ty(st, |x,y| conv(x,y)));
 
     ty::TypeParameterDef {
-        ident: ident,
+        name: name,
         def_id: def_id,
         space: space,
         index: index,
index ee31149165211b97eceaf661440095013b51bb40..e11385654ccc04458b998e4df62a07ab8f2f6ddd 100644 (file)
@@ -383,7 +383,7 @@ pub fn enc_bounds(w: &mut SeekableMemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
 
 pub fn enc_type_param_def(w: &mut SeekableMemWriter, cx: &ctxt, v: &ty::TypeParameterDef) {
     mywrite!(w, "{}:{}|{}|{}|",
-             token::get_ident(v.ident), (cx.ds)(v.def_id),
+             token::get_name(v.name), (cx.ds)(v.def_id),
              v.space.to_uint(), v.index);
     enc_opt(w, v.associated_with, |w, did| mywrite!(w, "{}", (cx.ds)(did)));
     mywrite!(w, "|");
index c413eb67a73ac05ba34641f3e5ef0ed276c003ed..f5b4dc7273e91fb892821bb87fd5a56b96439609 100644 (file)
@@ -670,7 +670,7 @@ fn walk_struct_expr(&mut self,
             if !contains_field_named(with_field, fields) {
                 let cmt_field = self.mc.cat_field(&*with_expr,
                                                   with_cmt.clone(),
-                                                  with_field.ident,
+                                                  with_field.name,
                                                   with_field.mt.ty);
                 self.delegate_consume(with_expr.id, with_expr.span, cmt_field);
             }
@@ -681,7 +681,7 @@ fn contains_field_named(field: &ty::field,
                                 -> bool
         {
             fields.iter().any(
-                |f| f.ident.node.name == field.ident.name)
+                |f| f.ident.node.name == field.name)
         }
     }
 
index 9bd3f49eea6ba6c1372dd84374b243ff5bb19f9c..9646b40ebe37cae8c56c0d0340f30d1b566fedee 100644 (file)
@@ -472,7 +472,7 @@ pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt> {
                    expr.id,
                    expr.repr(self.tcx()),
                    base_cmt.repr(self.tcx()));
-            Ok(self.cat_field(expr, base_cmt, f_name.node, expr_ty))
+            Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
           }
 
           ast::ExprTupField(ref base, idx, _) => {
@@ -820,14 +820,14 @@ pub fn cat_rvalue(&self,
     pub fn cat_field<N:ast_node>(&self,
                                  node: &N,
                                  base_cmt: cmt,
-                                 f_name: ast::Ident,
+                                 f_name: ast::Name,
                                  f_ty: ty::t)
                                  -> cmt {
         Rc::new(cmt_ {
             id: node.id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
-            cat: cat_interior(base_cmt, InteriorField(NamedField(f_name.name))),
+            cat: cat_interior(base_cmt, InteriorField(NamedField(f_name))),
             ty: f_ty,
             note: NoteNone
         })
@@ -1223,7 +1223,7 @@ pub fn cat_pattern(&self,
             // {f1: p1, ..., fN: pN}
             for fp in field_pats.iter() {
                 let field_ty = if_ok!(self.pat_ty(&*fp.pat)); // see (*2)
-                let cmt_field = self.cat_field(pat, cmt.clone(), fp.ident, field_ty);
+                let cmt_field = self.cat_field(pat, cmt.clone(), fp.ident.name, field_ty);
                 if_ok!(self.cat_pattern(cmt_field, &*fp.pat, |x,y,z| op(x,y,z)));
             }
           }
index eaec715a6a7e4015caa18fe1d9ae6e05ae54d529..9c06ddca7e8ae0b6761595d4c04ac4b3762e5709 100644 (file)
@@ -212,7 +212,7 @@ fn visit_ty(&mut self, ty: &Ty) {
 
 /// Contains data for specific types of import directives.
 enum ImportDirectiveSubclass {
-    SingleImport(Ident /* target */, Ident /* source */),
+    SingleImport(Name /* target */, Name /* source */),
     GlobImport
 }
 
@@ -376,7 +376,7 @@ fn new(kind: RibKind) -> Rib {
 
 /// One import directive.
 struct ImportDirective {
-    module_path: Vec<Ident>,
+    module_path: Vec<Name>,
     subclass: ImportDirectiveSubclass,
     span: Span,
     id: NodeId,
@@ -385,7 +385,7 @@ struct ImportDirective {
 }
 
 impl ImportDirective {
-    fn new(module_path: Vec<Ident> ,
+    fn new(module_path: Vec<Name> ,
            subclass: ImportDirectiveSubclass,
            span: Span,
            id: NodeId,
@@ -482,7 +482,7 @@ fn id(&self, namespace: Namespace) -> NodeId {
 #[deriving(Clone)]
 enum ParentLink {
     NoParentLink,
-    ModuleParentLink(Weak<Module>, Ident),
+    ModuleParentLink(Weak<Module>, Name),
     BlockParentLink(Weak<Module>, NodeId)
 }
 
@@ -1058,7 +1058,7 @@ fn build_reduced_graph(&mut self, krate: &ast::Crate) {
      * a block, fails.
      */
     fn add_child(&self,
-                 name: Ident,
+                 name: Name,
                  reduced_graph_parent: ReducedGraphParent,
                  duplicate_checking_mode: DuplicateCheckingMode,
                  // For printing errors
@@ -1071,15 +1071,15 @@ fn add_child(&self,
         let module_ = reduced_graph_parent.module();
 
         self.check_for_conflicts_between_external_crates_and_items(&*module_,
-                                                                   name.name,
+                                                                   name,
                                                                    sp);
 
         // Add or reuse the child.
-        let child = module_.children.borrow().find_copy(&name.name);
+        let child = module_.children.borrow().find_copy(&name);
         match child {
             None => {
                 let child = Rc::new(NameBindings::new());
-                module_.children.borrow_mut().insert(name.name, child.clone());
+                module_.children.borrow_mut().insert(name, child.clone());
                 child
             }
             Some(child) => {
@@ -1149,14 +1149,14 @@ fn add_child(&self,
                     self.resolve_error(sp,
                         format!("duplicate definition of {} `{}`",
                              namespace_error_to_string(duplicate_type),
-                             token::get_ident(name)).as_slice());
+                             token::get_name(name)).as_slice());
                     {
                         let r = child.span_for_namespace(ns);
                         for sp in r.iter() {
                             self.session.span_note(*sp,
                                  format!("first definition of {} `{}` here",
                                       namespace_error_to_string(duplicate_type),
-                                      token::get_ident(name)).as_slice());
+                                      token::get_name(name)).as_slice());
                         }
                     }
                 }
@@ -1196,7 +1196,7 @@ fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
         return false;
     }
 
-    fn get_parent_link(&mut self, parent: ReducedGraphParent, name: Ident)
+    fn get_parent_link(&mut self, parent: ReducedGraphParent, name: Name)
                            -> ParentLink {
         match parent {
             ModuleReducedGraphParent(module_) => {
@@ -1211,16 +1211,16 @@ fn build_reduced_graph_for_item(&mut self,
                                     parent: ReducedGraphParent)
                                     -> ReducedGraphParent
     {
-        let ident = item.ident;
+        let name = item.ident.name;
         let sp = item.span;
         let is_public = item.vis == ast::Public;
 
         match item.node {
             ItemMod(..) => {
                 let name_bindings =
-                    self.add_child(ident, parent.clone(), ForbidDuplicateModules, sp);
+                    self.add_child(name, parent.clone(), ForbidDuplicateModules, sp);
 
-                let parent_link = self.get_parent_link(parent, ident);
+                let parent_link = self.get_parent_link(parent, name);
                 let def_id = DefId { krate: 0, node: item.id };
                 name_bindings.define_module(parent_link,
                                             Some(def_id),
@@ -1237,7 +1237,7 @@ fn build_reduced_graph_for_item(&mut self,
             // These items live in the value namespace.
             ItemStatic(_, m, _) => {
                 let name_bindings =
-                    self.add_child(ident, parent.clone(), ForbidDuplicateValues, sp);
+                    self.add_child(name, parent.clone(), ForbidDuplicateValues, sp);
                 let mutbl = m == ast::MutMutable;
 
                 name_bindings.define_value
@@ -1245,14 +1245,14 @@ fn build_reduced_graph_for_item(&mut self,
                 parent
             }
             ItemConst(_, _) => {
-                self.add_child(ident, parent.clone(), ForbidDuplicateValues, sp)
+                self.add_child(name, parent.clone(), ForbidDuplicateValues, sp)
                     .define_value(DefConst(local_def(item.id)),
                                   sp, is_public);
                 parent
             }
             ItemFn(_, fn_style, _, _, _) => {
                 let name_bindings =
-                    self.add_child(ident, parent.clone(), ForbidDuplicateValues, sp);
+                    self.add_child(name, parent.clone(), ForbidDuplicateValues, sp);
 
                 let def = DefFn(local_def(item.id), fn_style, false);
                 name_bindings.define_value(def, sp, is_public);
@@ -1262,7 +1262,7 @@ fn build_reduced_graph_for_item(&mut self,
             // These items live in the type namespace.
             ItemTy(..) => {
                 let name_bindings =
-                    self.add_child(ident,
+                    self.add_child(name,
                                    parent.clone(),
                                    ForbidDuplicateTypesAndModules,
                                    sp);
@@ -1274,7 +1274,7 @@ fn build_reduced_graph_for_item(&mut self,
 
             ItemEnum(ref enum_definition, _) => {
                 let name_bindings =
-                    self.add_child(ident,
+                    self.add_child(name,
                                    parent.clone(),
                                    ForbidDuplicateTypesAndModules,
                                    sp);
@@ -1300,7 +1300,7 @@ fn build_reduced_graph_for_item(&mut self,
                     None            => (ForbidDuplicateTypesAndModules, None)
                 };
 
-                let name_bindings = self.add_child(ident, parent.clone(), forbid, sp);
+                let name_bindings = self.add_child(name, parent.clone(), forbid, sp);
 
                 // Define a name in the type namespace.
                 name_bindings.define_type(DefTy(local_def(item.id), false), sp, is_public);
@@ -1335,10 +1335,10 @@ fn build_reduced_graph_for_item(&mut self,
                 // Create the module and add all methods.
                 match ty.node {
                     TyPath(ref path, _, _) if path.segments.len() == 1 => {
-                        let name = path.segments.last().unwrap().identifier;
+                        let mod_name = path.segments.last().unwrap().identifier.name;
 
                         let parent_opt = parent.module().children.borrow()
-                                               .find_copy(&name.name);
+                                               .find_copy(&mod_name);
                         let new_parent = match parent_opt {
                             // It already exists
                             Some(ref child) if child.get_module_if_available()
@@ -1350,13 +1350,13 @@ fn build_reduced_graph_for_item(&mut self,
                             // Create the module
                             _ => {
                                 let name_bindings =
-                                    self.add_child(name,
+                                    self.add_child(mod_name,
                                                    parent.clone(),
                                                    ForbidDuplicateModules,
                                                    sp);
 
                                 let parent_link =
-                                    self.get_parent_link(parent.clone(), ident);
+                                    self.get_parent_link(parent.clone(), name);
                                 let def_id = local_def(item.id);
                                 let ns = TypeNS;
                                 let is_public =
@@ -1380,9 +1380,9 @@ fn build_reduced_graph_for_item(&mut self,
                             match *impl_item {
                                 MethodImplItem(ref method) => {
                                     // Add the method to the module.
-                                    let ident = method.pe_ident();
+                                    let name = method.pe_ident().name;
                                     let method_name_bindings =
-                                        self.add_child(ident,
+                                        self.add_child(name,
                                                        new_parent.clone(),
                                                        ForbidDuplicateValues,
                                                        method.span);
@@ -1413,10 +1413,10 @@ fn build_reduced_graph_for_item(&mut self,
                                 }
                                 TypeImplItem(ref typedef) => {
                                     // Add the typedef to the module.
-                                    let ident = typedef.ident;
+                                    let name = typedef.ident.name;
                                     let typedef_name_bindings =
                                         self.add_child(
-                                            ident,
+                                            name,
                                             new_parent.clone(),
                                             ForbidDuplicateTypesAndModules,
                                             typedef.span);
@@ -1448,13 +1448,13 @@ fn build_reduced_graph_for_item(&mut self,
 
             ItemTrait(_, _, _, ref methods) => {
                 let name_bindings =
-                    self.add_child(ident,
+                    self.add_child(name,
                                    parent.clone(),
                                    ForbidDuplicateTypesAndModules,
                                    sp);
 
                 // Add all the methods within to a new module.
-                let parent_link = self.get_parent_link(parent.clone(), ident);
+                let parent_link = self.get_parent_link(parent.clone(), name);
                 name_bindings.define_module(parent_link,
                                             Some(local_def(item.id)),
                                             TraitModuleKind,
@@ -1468,13 +1468,13 @@ fn build_reduced_graph_for_item(&mut self,
 
                 // Add the names of all the methods to the trait info.
                 for method in methods.iter() {
-                    let (ident, kind) = match *method {
+                    let (name, kind) = match *method {
                         ast::RequiredMethod(_) |
                         ast::ProvidedMethod(_) => {
                             let ty_m =
                                 ast_util::trait_item_to_ty_method(method);
 
-                            let ident = ty_m.ident;
+                            let name = ty_m.ident.name;
 
                             // Add it as a name in the trait module.
                             let (def, static_flag) = match ty_m.explicit_self
@@ -1497,7 +1497,7 @@ fn build_reduced_graph_for_item(&mut self,
                             };
 
                             let method_name_bindings =
-                                self.add_child(ident,
+                                self.add_child(name,
                                                module_parent.clone(),
                                                ForbidDuplicateTypesAndValues,
                                                ty_m.span);
@@ -1505,14 +1505,14 @@ fn build_reduced_graph_for_item(&mut self,
                                                               ty_m.span,
                                                               true);
 
-                            (ident, static_flag)
+                            (name, static_flag)
                         }
                         ast::TypeTraitItem(ref associated_type) => {
                             let def = DefAssociatedTy(local_def(
                                     associated_type.id));
 
                             let name_bindings =
-                                self.add_child(associated_type.ident,
+                                self.add_child(associated_type.ident.name,
                                                module_parent.clone(),
                                                ForbidDuplicateTypesAndValues,
                                                associated_type.span);
@@ -1520,11 +1520,11 @@ fn build_reduced_graph_for_item(&mut self,
                                                       associated_type.span,
                                                       true);
 
-                            (associated_type.ident, TypeTraitItemKind)
+                            (associated_type.ident.name, TypeTraitItemKind)
                         }
                     };
 
-                    self.trait_item_map.insert((ident.name, def_id), kind);
+                    self.trait_item_map.insert((name, def_id), kind);
                 }
 
                 name_bindings.define_type(DefTrait(def_id), sp, is_public);
@@ -1541,7 +1541,7 @@ fn build_reduced_graph_for_variant(&mut self,
                                        item_id: DefId,
                                        parent: ReducedGraphParent,
                                        is_public: bool) {
-        let ident = variant.node.name;
+        let name = variant.node.name.name;
         let is_exported = match variant.node.kind {
             TupleVariantKind(_) => false,
             StructVariantKind(_) => {
@@ -1551,7 +1551,7 @@ fn build_reduced_graph_for_variant(&mut self,
             }
         };
 
-        let child = self.add_child(ident, parent,
+        let child = self.add_child(name, parent,
                                    ForbidDuplicateTypesAndValues,
                                    variant.span);
         child.define_value(DefVariant(item_id,
@@ -1575,14 +1575,14 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                     ViewPathSimple(_, ref full_path, _) => {
                         full_path.segments
                             .as_slice().init()
-                            .iter().map(|ident| ident.identifier)
+                            .iter().map(|ident| ident.identifier.name)
                             .collect()
                     }
 
                     ViewPathGlob(ref module_ident_path, _) |
                     ViewPathList(ref module_ident_path, _, _) => {
                         module_ident_path.segments
-                            .iter().map(|ident| ident.identifier).collect()
+                            .iter().map(|ident| ident.identifier.name).collect()
                     }
                 };
 
@@ -1593,21 +1593,21 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                     view_item.attrs
                              .iter()
                              .any(|attr| {
-                                 attr.name() == token::get_ident(
-                                    special_idents::prelude_import)
+                                 attr.name() == token::get_name(
+                                    special_idents::prelude_import.name)
                              });
 
                 match view_path.node {
                     ViewPathSimple(binding, ref full_path, id) => {
-                        let source_ident =
-                            full_path.segments.last().unwrap().identifier;
-                        if token::get_ident(source_ident).get() == "mod" {
+                        let source_name =
+                            full_path.segments.last().unwrap().identifier.name;
+                        if token::get_name(source_name).get() == "mod" {
                             self.resolve_error(view_path.span,
                                 "`mod` imports are only allowed within a { } list");
                         }
 
-                        let subclass = SingleImport(binding,
-                                                    source_ident);
+                        let subclass = SingleImport(binding.name,
+                                                    source_name);
                         self.build_import_directive(&*module_,
                                                     module_path,
                                                     subclass,
@@ -1634,10 +1634,10 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                         for source_item in source_items.iter() {
                             let (module_path, name) = match source_item.node {
                                 PathListIdent { name, .. } =>
-                                    (module_path.clone(), name),
+                                    (module_path.clone(), name.name),
                                 PathListMod { .. } => {
                                     let name = match module_path.last() {
-                                        Some(ident) => ident.clone(),
+                                        Some(name) => *name,
                                         None => {
                                             self.resolve_error(source_item.span,
                                                 "`mod` import can only appear in an import list \
@@ -1678,7 +1678,7 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                     let def_id = DefId { krate: crate_id, node: 0 };
                     self.external_exports.insert(def_id);
                     let parent_link =
-                        ModuleParentLink(parent.module().downgrade(), name);
+                        ModuleParentLink(parent.module().downgrade(), name.name);
                     let external_module = Rc::new(Module::new(parent_link,
                                                               Some(def_id),
                                                               NormalModuleKind,
@@ -1703,7 +1703,7 @@ fn build_reduced_graph_for_foreign_item(&mut self,
                                             foreign_item: &ForeignItem,
                                             parent: ReducedGraphParent,
                                             f: |&mut Resolver|) {
-        let name = foreign_item.ident;
+        let name = foreign_item.ident.name;
         let is_public = foreign_item.vis == ast::Public;
         let name_bindings =
             self.add_child(name, parent, ForbidDuplicateValues,
@@ -1762,7 +1762,7 @@ fn handle_external_def(&mut self,
                            vis: Visibility,
                            child_name_bindings: &NameBindings,
                            final_ident: &str,
-                           ident: Ident,
+                           name: Name,
                            new_parent: ReducedGraphParent) {
         debug!("(building reduced graph for \
                 external crate) building external def, priv {}",
@@ -1799,7 +1799,7 @@ fn handle_external_def(&mut self,
                 debug!("(building reduced graph for \
                         external crate) building module \
                         {}", final_ident);
-                let parent_link = self.get_parent_link(new_parent.clone(), ident);
+                let parent_link = self.get_parent_link(new_parent.clone(), name);
 
                 child_name_bindings.define_module(parent_link,
                                                   Some(def_id),
@@ -1859,9 +1859,9 @@ fn handle_external_def(&mut self,
 
                   debug!("(building reduced graph for external crate) ... \
                           adding trait item '{}'",
-                         token::get_ident(trait_item_name));
+                         token::get_name(trait_item_name));
 
-                  self.trait_item_map.insert((trait_item_name.name, def_id), trait_item_kind);
+                  self.trait_item_map.insert((trait_item_name, def_id), trait_item_kind);
 
                   if is_exported {
                       self.external_exports
@@ -1872,7 +1872,7 @@ fn handle_external_def(&mut self,
               child_name_bindings.define_type(def, DUMMY_SP, is_public);
 
               // Define a module if necessary.
-              let parent_link = self.get_parent_link(new_parent, ident);
+              let parent_link = self.get_parent_link(new_parent, name);
               child_name_bindings.set_module_kind(parent_link,
                                                   Some(def_id),
                                                   TraitModuleKind,
@@ -1919,7 +1919,7 @@ fn handle_external_def(&mut self,
     fn build_reduced_graph_for_external_crate_def(&mut self,
                                                   root: Rc<Module>,
                                                   def_like: DefLike,
-                                                  ident: Ident,
+                                                  name: Name,
                                                   visibility: Visibility) {
         match def_like {
             DlDef(def) => {
@@ -1931,18 +1931,18 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                         csearch::each_child_of_item(&self.session.cstore,
                                                     def_id,
                                                     |def_like,
-                                                     child_ident,
+                                                     child_name,
                                                      vis| {
                             self.build_reduced_graph_for_external_crate_def(
                                 root.clone(),
                                 def_like,
-                                child_ident,
+                                child_name,
                                 vis)
                         });
                     }
                     _ => {
                         let child_name_bindings =
-                            self.add_child(ident,
+                            self.add_child(name,
                                            ModuleReducedGraphParent(root.clone()),
                                            OverwriteDuplicates,
                                            DUMMY_SP);
@@ -1950,8 +1950,8 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                         self.handle_external_def(def,
                                                  visibility,
                                                  &*child_name_bindings,
-                                                 token::get_ident(ident).get(),
-                                                 ident,
+                                                 token::get_name(name).get(),
+                                                 name,
                                                  ModuleReducedGraphParent(root));
                     }
                 }
@@ -1960,7 +1960,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                 // We only process static methods of impls here.
                 match csearch::get_type_name_if_impl(&self.session.cstore, def) {
                     None => {}
-                    Some(final_ident) => {
+                    Some(final_name) => {
                         let static_methods_opt =
                             csearch::get_static_methods_if_impl(&self.session.cstore, def);
                         match static_methods_opt {
@@ -1969,11 +1969,11 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                                 debug!("(building reduced graph for \
                                         external crate) processing \
                                         static methods for type name {}",
-                                        token::get_ident(final_ident));
+                                        token::get_name(final_name));
 
                                 let child_name_bindings =
                                     self.add_child(
-                                        final_ident,
+                                        final_name,
                                         ModuleReducedGraphParent(root.clone()),
                                         OverwriteDuplicates,
                                         DUMMY_SP);
@@ -1998,7 +1998,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                                     Some(_) | None => {
                                         let parent_link =
                                             self.get_parent_link(ModuleReducedGraphParent(root),
-                                                                 final_ident);
+                                                                 final_name);
                                         child_name_bindings.define_module(
                                             parent_link,
                                             Some(def),
@@ -2017,14 +2017,14 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                                     ModuleReducedGraphParent(type_module);
                                 for static_method_info in
                                         static_methods.iter() {
-                                    let ident = static_method_info.ident;
+                                    let name = static_method_info.name;
                                     debug!("(building reduced graph for \
                                              external crate) creating \
                                              static method '{}'",
-                                           token::get_ident(ident));
+                                           token::get_name(name));
 
                                     let method_name_bindings =
-                                        self.add_child(ident,
+                                        self.add_child(name,
                                                        new_parent.clone(),
                                                        OverwriteDuplicates,
                                                        DUMMY_SP);
@@ -2067,12 +2067,12 @@ fn populate_external_module(&mut self, module: Rc<Module>) {
 
         csearch::each_child_of_item(&self.session.cstore,
                                     def_id,
-                                    |def_like, child_ident, visibility| {
+                                    |def_like, child_name, visibility| {
             debug!("(populating external module) ... found ident: {}",
-                   token::get_ident(child_ident));
+                   token::get_name(child_name));
             self.build_reduced_graph_for_external_crate_def(module.clone(),
                                                             def_like,
-                                                            child_ident,
+                                                            child_name,
                                                             visibility)
         });
         module.populated.set(true)
@@ -2095,10 +2095,10 @@ fn build_reduced_graph_for_external_crate(&mut self, root: Rc<Module>) {
                                                   .get()
                                                   .unwrap()
                                                   .krate,
-                                              |def_like, ident, visibility| {
+                                              |def_like, name, visibility| {
             self.build_reduced_graph_for_external_crate_def(root.clone(),
                                                             def_like,
-                                                            ident,
+                                                            name,
                                                             visibility)
         });
     }
@@ -2106,7 +2106,7 @@ fn build_reduced_graph_for_external_crate(&mut self, root: Rc<Module>) {
     /// Creates and adds an import directive to the given module.
     fn build_import_directive(&mut self,
                               module_: &Module,
-                              module_path: Vec<Ident> ,
+                              module_path: Vec<Name>,
                               subclass: ImportDirectiveSubclass,
                               span: Span,
                               id: NodeId,
@@ -2126,13 +2126,13 @@ fn build_import_directive(&mut self,
             SingleImport(target, _) => {
                 debug!("(building import directive) building import \
                         directive: {}::{}",
-                       self.idents_to_string(module_.imports.borrow().last().unwrap()
+                       self.names_to_string(module_.imports.borrow().last().unwrap()
                                                  .module_path.as_slice()),
-                       token::get_ident(target));
+                       token::get_name(target));
 
                 let mut import_resolutions = module_.import_resolutions
                                                     .borrow_mut();
-                match import_resolutions.find_mut(&target.name) {
+                match import_resolutions.find_mut(&target) {
                     Some(resolution) => {
                         debug!("(building import directive) bumping \
                                 reference");
@@ -2149,7 +2149,7 @@ fn build_import_directive(&mut self,
                 debug!("(building import directive) creating new");
                 let mut resolution = ImportResolution::new(id, is_public);
                 resolution.outstanding_references = 1;
-                import_resolutions.insert(target.name, resolution);
+                import_resolutions.insert(target, resolution);
             }
             GlobImport => {
                 // Set the glob flag. This tells us that we don't know the
@@ -2259,26 +2259,26 @@ fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
         }
     }
 
-    fn idents_to_string(&self, idents: &[Ident]) -> String {
+    fn names_to_string(&self, names: &[Name]) -> String {
         let mut first = true;
         let mut result = String::new();
-        for ident in idents.iter() {
+        for name in names.iter() {
             if first {
                 first = false
             } else {
                 result.push_str("::")
             }
-            result.push_str(token::get_ident(*ident).get());
+            result.push_str(token::get_name(*name).get());
         };
         result
     }
 
-    fn path_idents_to_string(&self, path: &Path) -> String {
-        let identifiers: Vec<ast::Ident> = path.segments
-                                             .iter()
-                                             .map(|seg| seg.identifier)
-                                             .collect();
-        self.idents_to_string(identifiers.as_slice())
+    fn path_names_to_string(&self, path: &Path) -> String {
+        let names: Vec<ast::Name> = path.segments
+                                        .iter()
+                                        .map(|seg| seg.identifier.name)
+                                        .collect();
+        self.names_to_string(names.as_slice())
     }
 
     fn import_directive_subclass_to_string(&mut self,
@@ -2286,21 +2286,21 @@ fn import_directive_subclass_to_string(&mut self,
                                         -> String {
         match subclass {
             SingleImport(_, source) => {
-                token::get_ident(source).get().to_string()
+                token::get_name(source).get().to_string()
             }
             GlobImport => "*".to_string()
         }
     }
 
     fn import_path_to_string(&mut self,
-                          idents: &[Ident],
+                          names: &[Name],
                           subclass: ImportDirectiveSubclass)
                           -> String {
-        if idents.is_empty() {
+        if names.is_empty() {
             self.import_directive_subclass_to_string(subclass)
         } else {
             (format!("{}::{}",
-                     self.idents_to_string(idents),
+                     self.names_to_string(names),
                      self.import_directive_subclass_to_string(
                          subclass))).to_string()
         }
@@ -2320,7 +2320,7 @@ fn resolve_import_for_module(&mut self,
 
         debug!("(resolving import for module) resolving import `{}::...` in \
                 `{}`",
-               self.idents_to_string(module_path.as_slice()),
+               self.names_to_string(module_path.as_slice()),
                self.module_to_string(&*module_));
 
         // First, resolve the module path for the directive, if necessary.
@@ -2418,16 +2418,16 @@ fn create_name_bindings_from_module(module: Rc<Module>) -> NameBindings {
     fn resolve_single_import(&mut self,
                              module_: &Module,
                              containing_module: Rc<Module>,
-                             target: Ident,
-                             source: Ident,
+                             target: Name,
+                             source: Name,
                              directive: &ImportDirective,
                              lp: LastPrivate)
                                  -> ResolveResult<()> {
         debug!("(resolving single import) resolving `{}` = `{}::{}` from \
                 `{}` id {}, last private {}",
-               token::get_ident(target),
+               token::get_name(target),
                self.module_to_string(&*containing_module),
-               token::get_ident(source),
+               token::get_name(source),
                self.module_to_string(module_),
                directive.id,
                lp);
@@ -2450,7 +2450,7 @@ fn resolve_single_import(&mut self,
         // Search for direct children of the containing module.
         self.populate_module_if_necessary(&containing_module);
 
-        match containing_module.children.borrow().find(&source.name) {
+        match containing_module.children.borrow().find(&source) {
             None => {
                 // Continue.
             }
@@ -2486,7 +2486,7 @@ fn resolve_single_import(&mut self,
                 }
 
                 // Now search the exported imports within the containing module.
-                match containing_module.import_resolutions.borrow().find(&source.name) {
+                match containing_module.import_resolutions.borrow().find(&source) {
                     None => {
                         debug!("(resolving single import) no import");
                         // The containing module definitely doesn't have an
@@ -2573,7 +2573,7 @@ fn get_binding(this: &mut Resolver,
             BoundResult(..) => {}
             _ => {
                 match containing_module.external_module_children.borrow_mut()
-                                       .find_copy(&source.name) {
+                                       .find_copy(&source) {
                     None => {} // Continue.
                     Some(module) => {
                         debug!("(resolving single import) found external \
@@ -2596,7 +2596,7 @@ fn get_binding(this: &mut Resolver,
 
         // We've successfully resolved the import. Write the results in.
         let mut import_resolutions = module_.import_resolutions.borrow_mut();
-        let import_resolution = import_resolutions.get_mut(&target.name);
+        let import_resolution = import_resolutions.get_mut(&target);
 
         match value_result {
             BoundResult(ref target_module, ref name_bindings) => {
@@ -2605,7 +2605,7 @@ fn get_binding(this: &mut Resolver,
                 self.check_for_conflicting_import(
                     &import_resolution.value_target,
                     directive.span,
-                    target.name,
+                    target,
                     ValueNS);
 
                 import_resolution.value_target =
@@ -2628,7 +2628,7 @@ fn get_binding(this: &mut Resolver,
                 self.check_for_conflicting_import(
                     &import_resolution.type_target,
                     directive.span,
-                    target.name,
+                    target,
                     TypeNS);
 
                 import_resolution.type_target =
@@ -2649,11 +2649,11 @@ fn get_binding(this: &mut Resolver,
             module_,
             import_resolution,
             directive.span,
-            target.name);
+            target);
 
         if value_result.is_unbound() && type_result.is_unbound() {
             let msg = format!("There is no `{}` in `{}`",
-                              token::get_ident(source),
+                              token::get_name(source),
                               self.module_to_string(&*containing_module));
             return Failed(Some((directive.span, msg)));
         }
@@ -3052,7 +3052,7 @@ fn check_for_conflicts_between_external_crates_and_items(&self,
     /// Resolves the given module path from the given root `module_`.
     fn resolve_module_path_from_root(&mut self,
                                      module_: Rc<Module>,
-                                     module_path: &[Ident],
+                                     module_path: &[Name],
                                      index: uint,
                                      span: Span,
                                      name_search_type: NameSearchType,
@@ -3085,21 +3085,21 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
         while index < module_path_len {
             let name = module_path[index];
             match self.resolve_name_in_module(search_module.clone(),
-                                              name.name,
+                                              name,
                                               TypeNS,
                                               name_search_type,
                                               false) {
                 Failed(None) => {
-                    let segment_name = token::get_ident(name);
+                    let segment_name = token::get_name(name);
                     let module_name = self.module_to_string(&*search_module);
                     let mut span = span;
                     let msg = if "???" == module_name.as_slice() {
                         span.hi = span.lo + Pos::from_uint(segment_name.get().len());
 
-                        match search_parent_externals(name.name,
+                        match search_parent_externals(name,
                                                      &self.current_module) {
                             Some(module) => {
-                                let path_str = self.idents_to_string(module_path);
+                                let path_str = self.names_to_string(module_path);
                                 let target_mod_str = self.module_to_string(&*module);
                                 let current_mod_str =
                                     self.module_to_string(&*self.current_module);
@@ -3127,7 +3127,7 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
                 Indeterminate => {
                     debug!("(resolving module path for import) module \
                             resolution is indeterminate: {}",
-                            token::get_ident(name));
+                            token::get_name(name));
                     return Indeterminate;
                 }
                 Success((target, used_proxy)) => {
@@ -3138,7 +3138,7 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
                             match type_def.module_def {
                                 None => {
                                     let msg = format!("Not a module `{}`",
-                                                        token::get_ident(name));
+                                                        token::get_name(name));
 
                                     return Failed(Some((span, msg)));
                                 }
@@ -3188,7 +3188,7 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
                         None => {
                             // There are no type bindings at all.
                             let msg = format!("Not a module `{}`",
-                                              token::get_ident(name));
+                                              token::get_name(name));
                             return Failed(Some((span, msg)));
                         }
                     }
@@ -3208,7 +3208,7 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
     /// module found to the destination when resolving this path.
     fn resolve_module_path(&mut self,
                            module_: Rc<Module>,
-                           module_path: &[Ident],
+                           module_path: &[Name],
                            use_lexical_scope: UseLexicalScopeFlag,
                            span: Span,
                            name_search_type: NameSearchType)
@@ -3218,7 +3218,7 @@ fn resolve_module_path(&mut self,
 
         debug!("(resolving module path for import) processing `{}` rooted at \
                `{}`",
-               self.idents_to_string(module_path),
+               self.names_to_string(module_path),
                self.module_to_string(&*module_));
 
         // Resolve the module prefix, if any.
@@ -3230,7 +3230,7 @@ fn resolve_module_path(&mut self,
         let last_private;
         match module_prefix_result {
             Failed(None) => {
-                let mpath = self.idents_to_string(module_path);
+                let mpath = self.names_to_string(module_path);
                 let mpath = mpath.as_slice();
                 match mpath.rfind(':') {
                     Some(idx) => {
@@ -3305,12 +3305,12 @@ fn resolve_module_path(&mut self,
     /// import resolution.
     fn resolve_item_in_lexical_scope(&mut self,
                                      module_: Rc<Module>,
-                                     name: Ident,
+                                     name: Name,
                                      namespace: Namespace)
                                     -> ResolveResult<(Target, bool)> {
         debug!("(resolving item in lexical scope) resolving `{}` in \
                 namespace {} in `{}`",
-               token::get_ident(name),
+               token::get_name(name),
                namespace,
                self.module_to_string(&*module_));
 
@@ -3318,7 +3318,7 @@ fn resolve_item_in_lexical_scope(&mut self,
         // its immediate children.
         self.populate_module_if_necessary(&module_);
 
-        match module_.children.borrow().find(&name.name) {
+        match module_.children.borrow().find(&name) {
             Some(name_bindings)
                     if name_bindings.defined_in_namespace(namespace) => {
                 debug!("top name bindings succeeded");
@@ -3334,7 +3334,7 @@ fn resolve_item_in_lexical_scope(&mut self,
         // all its imports in the usual way; this is because chains of
         // adjacent import statements are processed as though they mutated the
         // current scope.
-        match module_.import_resolutions.borrow().find(&name.name) {
+        match module_.import_resolutions.borrow().find(&name) {
             None => {
                 // Not found; continue.
             }
@@ -3363,7 +3363,7 @@ fn resolve_item_in_lexical_scope(&mut self,
 
         // Search for external modules.
         if namespace == TypeNS {
-            match module_.external_module_children.borrow().find_copy(&name.name) {
+            match module_.external_module_children.borrow().find_copy(&name) {
                 None => {}
                 Some(module) => {
                     let name_bindings =
@@ -3412,7 +3412,7 @@ fn resolve_item_in_lexical_scope(&mut self,
 
             // Resolve the name in the parent module.
             match self.resolve_name_in_module(search_module.clone(),
-                                              name.name,
+                                              name,
                                               namespace,
                                               PathSearch,
                                               true) {
@@ -3441,7 +3441,7 @@ fn resolve_item_in_lexical_scope(&mut self,
     /// Resolves a module name in the current lexical scope.
     fn resolve_module_in_lexical_scope(&mut self,
                                        module_: Rc<Module>,
-                                       name: Ident)
+                                       name: Name)
                                 -> ResolveResult<Rc<Module>> {
         // If this module is an anonymous module, resolve the item in the
         // lexical scope. Otherwise, resolve the item from the crate root.
@@ -3526,13 +3526,13 @@ fn get_nearest_normal_module_parent_or_self(&mut self, module_: Rc<Module>)
     /// grammar: (SELF MOD_SEP ) ? (SUPER MOD_SEP) *
     fn resolve_module_prefix(&mut self,
                              module_: Rc<Module>,
-                             module_path: &[Ident])
+                             module_path: &[Name])
                                  -> ResolveResult<ModulePrefixResult> {
         // Start at the current module if we see `self` or `super`, or at the
         // top of the crate otherwise.
         let mut containing_module;
         let mut i;
-        let first_module_path_string = token::get_ident(module_path[0]);
+        let first_module_path_string = token::get_name(module_path[0]);
         if "self" == first_module_path_string.get() {
             containing_module =
                 self.get_nearest_normal_module_parent_or_self(module_);
@@ -3547,7 +3547,7 @@ fn resolve_module_prefix(&mut self,
 
         // Now loop through all the `super`s we find.
         while i < module_path.len() {
-            let string = token::get_ident(module_path[i]);
+            let string = token::get_name(module_path[i]);
             if "super" != string.get() {
                 break
             }
@@ -3839,7 +3839,7 @@ fn add_exports_for_module(&mut self,
     // generate a fake "implementation scope" containing all the
     // implementations thus found, for compatibility with old resolve pass.
 
-    fn with_scope(&mut self, name: Option<Ident>, f: |&mut Resolver|) {
+    fn with_scope(&mut self, name: Option<Name>, f: |&mut Resolver|) {
         let orig_module = self.current_module.clone();
 
         // Move down in the graph.
@@ -3850,10 +3850,10 @@ fn with_scope(&mut self, name: Option<Ident>, f: |&mut Resolver|) {
             Some(name) => {
                 self.populate_module_if_necessary(&orig_module);
 
-                match orig_module.children.borrow().find(&name.name) {
+                match orig_module.children.borrow().find(&name) {
                     None => {
                         debug!("!!! (with scope) didn't find `{}` in `{}`",
-                               token::get_ident(name),
+                               token::get_name(name),
                                self.module_to_string(&*orig_module));
                     }
                     Some(name_bindings) => {
@@ -3861,7 +3861,7 @@ fn with_scope(&mut self, name: Option<Ident>, f: |&mut Resolver|) {
                             None => {
                                 debug!("!!! (with scope) didn't find module \
                                         for `{}` in `{}`",
-                                       token::get_ident(name),
+                                       token::get_name(name),
                                        self.module_to_string(&*orig_module));
                             }
                             Some(module_) => {
@@ -4050,8 +4050,10 @@ fn resolve_crate(&mut self, krate: &ast::Crate) {
     }
 
     fn resolve_item(&mut self, item: &Item) {
+        let name = item.ident.name;
+
         debug!("(resolving item) resolving {}",
-               token::get_ident(item.ident));
+               token::get_name(name));
 
         match item.node {
 
@@ -4190,14 +4192,14 @@ fn resolve_item(&mut self, item: &Item) {
             }
 
             ItemMod(ref module_) => {
-                self.with_scope(Some(item.ident), |this| {
-                    this.resolve_module(module_, item.span, item.ident,
+                self.with_scope(Some(name), |this| {
+                    this.resolve_module(module_, item.span, name,
                                         item.id);
                 });
             }
 
             ItemForeignMod(ref foreign_module) => {
-                self.with_scope(Some(item.ident), |this| {
+                self.with_scope(Some(name), |this| {
                     for foreign_item in foreign_module.items.iter() {
                         match foreign_item.node {
                             ForeignItemFn(_, ref generics) => {
@@ -4248,20 +4250,20 @@ fn with_type_parameter_rib(&mut self,
                 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 ident = type_parameter.ident;
+                    let name = type_parameter.ident.name;
                     debug!("with_type_parameter_rib: {} {}", node_id,
                            type_parameter.id);
 
-                    if seen_bindings.contains(&ident) {
+                    if seen_bindings.contains(&name) {
                         self.resolve_error(type_parameter.span,
                                            format!("the name `{}` is already \
                                                     used for a type \
                                                     parameter in this type \
                                                     parameter list",
-                                                   token::get_ident(
-                                                       ident)).as_slice())
+                                                   token::get_name(
+                                                       name)).as_slice())
                     }
-                    seen_bindings.insert(ident);
+                    seen_bindings.insert(name);
 
                     let def_like = DlDef(DefTyParam(space,
                                                     local_def(type_parameter.id),
@@ -4271,7 +4273,7 @@ fn with_type_parameter_rib(&mut self,
                     self.record_def(type_parameter.id,
                                     (DefTyParamBinder(node_id), LastMod(AllPublic)));
                     // plain insert (no renaming)
-                    function_type_rib.bindings.insert(ident.name, def_like);
+                    function_type_rib.bindings.insert(name, def_like);
                 }
                 self.type_ribs.push(function_type_rib);
             }
@@ -4404,7 +4406,7 @@ fn resolve_type_parameter_bound(&mut self,
                                         TypeNS,
                                         true) {
                     None => {
-                        let path_str = self.path_idents_to_string(
+                        let path_str = self.path_names_to_string(
                             &unboxed_function.path);
                         self.resolve_error(unboxed_function.path.span,
                                            format!("unresolved trait `{}`",
@@ -4418,7 +4420,7 @@ fn resolve_type_parameter_bound(&mut self,
                             _ => {
                                 let msg =
                                     format!("`{}` is not a trait",
-                                            self.path_idents_to_string(
+                                            self.path_names_to_string(
                                                 &unboxed_function.path));
                                 self.resolve_error(unboxed_function.path.span,
                                                    msg.as_slice());
@@ -4443,7 +4445,7 @@ fn resolve_trait_reference(&mut self,
                                reference_type: TraitReferenceType) {
         match self.resolve_path(id, &trait_reference.path, TypeNS, true) {
             None => {
-                let path_str = self.path_idents_to_string(&trait_reference.path);
+                let path_str = self.path_names_to_string(&trait_reference.path);
                 let usage_str = match reference_type {
                     TraitBoundingTypeParameter => "bound type parameter with",
                     TraitImplementation        => "implement",
@@ -4462,7 +4464,7 @@ fn resolve_trait_reference(&mut self,
                     (def, _) => {
                         self.resolve_error(trait_reference.path.span,
                                            format!("`{}` is not a trait",
-                                                   self.path_idents_to_string(
+                                                   self.path_names_to_string(
                                                         &trait_reference.path)));
 
                         // If it's a typedef, give a note
@@ -4609,7 +4611,7 @@ fn resolve_implementation(&mut self,
                             MethodImplItem(ref method) => {
                                 // If this is a trait impl, ensure the method
                                 // exists in trait
-                                this.check_trait_item(method.pe_ident(),
+                                this.check_trait_item(method.pe_ident().name,
                                                       method.span);
 
                                 // We also need a new scope for the method-
@@ -4621,7 +4623,7 @@ fn resolve_implementation(&mut self,
                             TypeImplItem(ref typedef) => {
                                 // If this is a trait impl, ensure the method
                                 // exists in trait
-                                this.check_trait_item(typedef.ident,
+                                this.check_trait_item(typedef.ident.name,
                                                       typedef.span);
 
                                 this.resolve_type(&*typedef.typ);
@@ -4657,23 +4659,21 @@ fn resolve_implementation(&mut self,
         }
     }
 
-    fn check_trait_item(&self, ident: Ident, span: Span) {
+    fn check_trait_item(&self, name: Name, span: Span) {
         // If there is a TraitRef in scope for an impl, then the method must be in the trait.
         for &(did, ref trait_ref) in self.current_trait_ref.iter() {
-            let method_name = ident.name;
-
-            if self.trait_item_map.find(&(method_name, did)).is_none() {
-                let path_str = self.path_idents_to_string(&trait_ref.path);
+            if self.trait_item_map.find(&(name, did)).is_none() {
+                let path_str = self.path_names_to_string(&trait_ref.path);
                 self.resolve_error(span,
                                     format!("method `{}` is not a member of trait `{}`",
-                                            token::get_name(method_name),
+                                            token::get_name(name),
                                             path_str).as_slice());
             }
         }
     }
 
     fn resolve_module(&mut self, module: &Mod, _span: Span,
-                      _name: Ident, id: NodeId) {
+                      _name: Name, id: NodeId) {
         // Write the implementations in scope into the module metadata.
         debug!("(resolving module) resolving module ID {}", id);
         visit::walk_mod(self, module);
@@ -4869,13 +4869,13 @@ fn resolve_type(&mut self, ty: &Ty) {
                         // Write the result into the def map.
                         debug!("(resolving type) writing resolution for `{}` \
                                 (id {})",
-                               self.path_idents_to_string(path),
+                               self.path_names_to_string(path),
                                path_id);
                         self.record_def(path_id, def);
                     }
                     None => {
                         let msg = format!("use of undeclared type name `{}`",
-                                          self.path_idents_to_string(path));
+                                          self.path_names_to_string(path));
                         self.resolve_error(ty.span, msg.as_slice());
                     }
                 }
@@ -4890,15 +4890,15 @@ fn resolve_type(&mut self, ty: &Ty) {
                 self.resolve_type(&*qpath.for_type);
 
                 let current_module = self.current_module.clone();
-                let module_path_idents: Vec<_> =
+                let module_path: Vec<_> =
                     qpath.trait_name
                          .segments
                          .iter()
-                         .map(|ps| ps.identifier)
+                         .map(|ps| ps.identifier.name)
                          .collect();
                 match self.resolve_module_path(
                         current_module,
-                        module_path_idents.as_slice(),
+                        module_path.as_slice(),
                         UseLexicalScope,
                         qpath.trait_name.span,
                         PathSearch) {
@@ -4968,7 +4968,7 @@ fn resolve_pattern(&mut self,
                        mode: PatternBindingMode,
                        // Maps idents to the node ID for the (outermost)
                        // pattern that binds them
-                       bindings_list: &mut HashMap<Name,NodeId>) {
+                       bindings_list: &mut HashMap<Name, NodeId>) {
         let pat_id = pattern.id;
         walk_pat(pattern, |pattern| {
             match pattern.node {
@@ -4986,7 +4986,7 @@ fn resolve_pattern(&mut self,
                     let ident = path1.node;
                     let renamed = mtwt::resolve(ident);
 
-                    match self.resolve_bare_identifier_pattern(ident, pattern.span) {
+                    match self.resolve_bare_identifier_pattern(ident.name, pattern.span) {
                         FoundStructOrEnumVariant(ref def, lp)
                                 if mode == RefutableMode => {
                             debug!("(resolving pattern) resolving `{}` to \
@@ -5135,7 +5135,7 @@ struct or enum variant",
                             debug!("(resolving pattern) didn't find struct \
                                     def: {}", result);
                             let msg = format!("`{}` does not name a structure",
-                                              self.path_idents_to_string(path));
+                                              self.path_names_to_string(path));
                             self.resolve_error(path.span, msg.as_slice());
                         }
                     }
@@ -5149,7 +5149,7 @@ struct or enum variant",
         });
     }
 
-    fn resolve_bare_identifier_pattern(&mut self, name: Ident, span: Span)
+    fn resolve_bare_identifier_pattern(&mut self, name: Name, span: Span)
                                        -> BareIdentifierPatternResolution {
         let module = self.current_module.clone();
         match self.resolve_item_in_lexical_scope(module,
@@ -5158,7 +5158,7 @@ fn resolve_bare_identifier_pattern(&mut self, name: Ident, span: Span)
             Success((target, _)) => {
                 debug!("(resolve bare identifier pattern) succeeded in \
                          finding {} at {}",
-                        token::get_ident(name),
+                        token::get_name(name),
                         target.bindings.value_def.borrow());
                 match *target.bindings.value_def.borrow() {
                     None => {
@@ -5204,7 +5204,7 @@ fn resolve_bare_identifier_pattern(&mut self, name: Ident, span: Span)
                 }
 
                 debug!("(resolve bare identifier pattern) failed to find {}",
-                        token::get_ident(name));
+                        token::get_name(name));
                 return BareIdentifierPatternUnresolved;
             }
         }
@@ -5273,8 +5273,7 @@ fn resolve_identifier(&mut self,
             }
         }
 
-        return self.resolve_item_by_identifier_in_lexical_scope(identifier,
-                                                                namespace);
+        return self.resolve_item_by_name_in_lexical_scope(identifier.name, namespace);
     }
 
     // FIXME #4952: Merge me with resolve_name_in_module?
@@ -5364,15 +5363,15 @@ fn resolve_module_relative_path(&mut self,
                                         path: &Path,
                                         namespace: Namespace)
                                         -> Option<(Def, LastPrivate)> {
-        let module_path_idents = path.segments.init().iter()
-                                                     .map(|ps| ps.identifier)
-                                                     .collect::<Vec<_>>();
+        let module_path = path.segments.init().iter()
+                                              .map(|ps| ps.identifier.name)
+                                              .collect::<Vec<_>>();
 
         let containing_module;
         let last_private;
         let module = self.current_module.clone();
         match self.resolve_module_path(module,
-                                       module_path_idents.as_slice(),
+                                       module_path.as_slice(),
                                        UseLexicalScope,
                                        path.span,
                                        PathSearch) {
@@ -5381,8 +5380,8 @@ fn resolve_module_relative_path(&mut self,
                     Some((span, msg)) => (span, msg),
                     None => {
                         let msg = format!("Use of undeclared module `{}`",
-                                          self.idents_to_string(
-                                               module_path_idents.as_slice()));
+                                          self.names_to_string(
+                                               module_path.as_slice()));
                         (path.span, msg)
                     }
                 };
@@ -5398,9 +5397,9 @@ fn resolve_module_relative_path(&mut self,
             }
         }
 
-        let ident = path.segments.last().unwrap().identifier;
+        let name = path.segments.last().unwrap().identifier.name;
         let def = match self.resolve_definition_of_name_in_module(containing_module.clone(),
-                                                                  ident.name,
+                                                                  name,
                                                                   namespace) {
             NoNameDefinition => {
                 // We failed to resolve the name. Report an error.
@@ -5423,16 +5422,16 @@ fn resolve_crate_relative_path(&mut self,
                                    path: &Path,
                                    namespace: Namespace)
                                        -> Option<(Def, LastPrivate)> {
-        let module_path_idents = path.segments.init().iter()
-                                                     .map(|ps| ps.identifier)
-                                                     .collect::<Vec<_>>();
+        let module_path = path.segments.init().iter()
+                                              .map(|ps| ps.identifier.name)
+                                              .collect::<Vec<_>>();
 
         let root_module = self.graph_root.get_module();
 
         let containing_module;
         let last_private;
         match self.resolve_module_path_from_root(root_module,
-                                                 module_path_idents.as_slice(),
+                                                 module_path.as_slice(),
                                                  0,
                                                  path.span,
                                                  PathSearch,
@@ -5442,8 +5441,7 @@ fn resolve_crate_relative_path(&mut self,
                     Some((span, msg)) => (span, msg),
                     None => {
                         let msg = format!("Use of undeclared module `::{}`",
-                                          self.idents_to_string(
-                                               module_path_idents.as_slice()));
+                                          self.names_to_string(module_path.as_slice()));
                         (path.span, msg)
                     }
                 };
@@ -5509,14 +5507,14 @@ fn resolve_identifier_in_local_ribs(&mut self,
         }
     }
 
-    fn resolve_item_by_identifier_in_lexical_scope(&mut self,
-                                                   ident: Ident,
-                                                   namespace: Namespace)
-                                                -> Option<(Def, LastPrivate)> {
+    fn resolve_item_by_name_in_lexical_scope(&mut self,
+                                             name: Name,
+                                             namespace: Namespace)
+                                            -> Option<(Def, LastPrivate)> {
         // Check the items.
         let module = self.current_module.clone();
         match self.resolve_item_in_lexical_scope(module,
-                                                 ident,
+                                                 name,
                                                  namespace) {
             Success((target, _)) => {
                 match (*target.bindings).def_for_namespace(namespace) {
@@ -5525,13 +5523,13 @@ fn resolve_item_by_identifier_in_lexical_scope(&mut self,
                         // found a module instead. Modules don't have defs.
                         debug!("(resolving item path by identifier in lexical \
                                  scope) failed to resolve {} after success...",
-                                 token::get_ident(ident));
+                                 token::get_name(name));
                         return None;
                     }
                     Some(def) => {
                         debug!("(resolving item path in lexical scope) \
                                 resolved `{}` to item",
-                               token::get_ident(ident));
+                               token::get_name(name));
                         // This lookup is "all public" because it only searched
                         // for one identifier in the current module (couldn't
                         // have passed through reexports or anything like that.
@@ -5550,7 +5548,7 @@ fn resolve_item_by_identifier_in_lexical_scope(&mut self,
                 }
 
                 debug!("(resolving item path by identifier in lexical scope) \
-                         failed to resolve {}", token::get_ident(ident));
+                         failed to resolve {}", token::get_name(name));
                 return None;
             }
         }
@@ -5589,16 +5587,16 @@ fn extract_path_and_node_id(t: &Ty, allow: FallbackChecks)
             }
         }
 
-        fn get_module(this: &mut Resolver, span: Span, ident_path: &[ast::Ident])
+        fn get_module(this: &mut Resolver, span: Span, name_path: &[ast::Name])
                             -> Option<Rc<Module>> {
             let root = this.current_module.clone();
-            let last_name = ident_path.last().unwrap().name;
+            let last_name = name_path.last().unwrap();
 
-            if ident_path.len() == 1 {
-                match this.primitive_type_table.primitive_types.find(&last_name) {
+            if name_path.len() == 1 {
+                match this.primitive_type_table.primitive_types.find(last_name) {
                     Some(_) => None,
                     None => {
-                        match this.current_module.children.borrow().find(&last_name) {
+                        match this.current_module.children.borrow().find(last_name) {
                             Some(child) => child.get_module_if_available(),
                             None => None
                         }
@@ -5606,7 +5604,7 @@ fn get_module(this: &mut Resolver, span: Span, ident_path: &[ast::Ident])
                 }
             } else {
                 match this.resolve_module_path(root,
-                                                ident_path.as_slice(),
+                                                name_path.as_slice(),
                                                 UseLexicalScope,
                                                 span,
                                                 PathSearch) {
@@ -5641,13 +5639,13 @@ fn get_module(this: &mut Resolver, span: Span, ident_path: &[ast::Ident])
             }
         }
 
-        let ident_path = path.segments.iter().map(|seg| seg.identifier).collect::<Vec<_>>();
+        let name_path = path.segments.iter().map(|seg| seg.identifier.name).collect::<Vec<_>>();
 
         // Look for a method in the current self type's impl module.
-        match get_module(self, path.span, ident_path.as_slice()) {
+        match get_module(self, path.span, name_path.as_slice()) {
             Some(module) => match module.children.borrow().find(&name) {
                 Some(binding) => {
-                    let p_str = self.path_idents_to_string(&path);
+                    let p_str = self.path_names_to_string(&path);
                     match binding.def_for_namespace(ValueNS) {
                         Some(DefStaticMethod(_, provenance, _)) => {
                             match provenance {
@@ -5668,7 +5666,7 @@ fn get_module(this: &mut Resolver, span: Span, ident_path: &[ast::Ident])
         // Look for a method in the current trait.
         match self.current_trait_ref {
             Some((did, ref trait_ref)) => {
-                let path_str = self.path_idents_to_string(&trait_ref.path);
+                let path_str = self.path_names_to_string(&trait_ref.path);
 
                 match self.trait_item_map.find(&(name, did)) {
                     Some(&StaticMethodTraitItemKind) => {
@@ -5739,11 +5737,12 @@ fn resolve_expr(&mut self, expr: &Expr) {
                     Some(def) => {
                         // Write the result into the def map.
                         debug!("(resolving expr) resolved `{}`",
-                               self.path_idents_to_string(path));
+                               self.path_names_to_string(path));
+
                         self.record_def(expr.id, def);
                     }
                     None => {
-                        let wrong_name = self.path_idents_to_string(path);
+                        let wrong_name = self.path_names_to_string(path);
                         // Be helpful if the name refers to a struct
                         // (The pattern matching def_tys where the id is in self.structs
                         // matches on regular structs while excluding tuple- and enum-like
@@ -5851,7 +5850,7 @@ fn resolve_expr(&mut self, expr: &Expr) {
                         debug!("(resolving expression) didn't find struct \
                                 def: {}", result);
                         let msg = format!("`{}` does not name a structure",
-                                          self.path_idents_to_string(path));
+                                          self.path_names_to_string(path));
                         self.resolve_error(path.span, msg.as_slice());
                     }
                 }
@@ -6196,30 +6195,30 @@ fn finalize_import(&mut self, id: NodeId, span: Span) {
 
     /// A somewhat inefficient routine to obtain the name of a module.
     fn module_to_string(&self, module: &Module) -> String {
-        let mut idents = Vec::new();
+        let mut names = Vec::new();
 
-        fn collect_mod(idents: &mut Vec<ast::Ident>, module: &Module) {
+        fn collect_mod(names: &mut Vec<ast::Name>, module: &Module) {
             match module.parent_link {
                 NoParentLink => {}
                 ModuleParentLink(ref module, name) => {
-                    idents.push(name);
-                    collect_mod(idents, &*module.upgrade().unwrap());
+                    names.push(name);
+                    collect_mod(names, &*module.upgrade().unwrap());
                 }
                 BlockParentLink(ref module, _) => {
                     // danger, shouldn't be ident?
-                    idents.push(special_idents::opaque);
-                    collect_mod(idents, &*module.upgrade().unwrap());
+                    names.push(special_idents::opaque.name);
+                    collect_mod(names, &*module.upgrade().unwrap());
                 }
             }
         }
-        collect_mod(&mut idents, module);
+        collect_mod(&mut names, module);
 
-        if idents.len() == 0 {
+        if names.len() == 0 {
             return "???".to_string();
         }
-        self.idents_to_string(idents.into_iter().rev()
-                                 .collect::<Vec<ast::Ident>>()
-                                 .as_slice())
+        self.names_to_string(names.into_iter().rev()
+                                  .collect::<Vec<ast::Name>>()
+                                  .as_slice())
     }
 
     #[allow(dead_code)]   // useful for debugging
index dd9601f1c3cfab28f074b011a70c0bfdce86465f..5c2c879040ff892802f50988d570296b171c002a 100644 (file)
@@ -794,7 +794,7 @@ fn process_path(&mut self,
                                                  def_id)
                                     .iter()
                                     .find(|mr| {
-                                        mr.ident().name == ti.ident().name
+                                        mr.name() == ti.name()
                                     })
                                     .unwrap()
                                     .def_id())
@@ -807,10 +807,10 @@ fn process_path(&mut self,
                             Some((*impl_items)[def_id]
                                            .iter()
                                            .find(|mr| {
-                                            ty::impl_or_trait_item(
-                                                &self.analysis.ty_cx,
-                                                mr.def_id()).ident().name ==
-                                                ti.ident().name
+                                                ty::impl_or_trait_item(
+                                                    &self.analysis.ty_cx,
+                                                    mr.def_id()
+                                                ).name() == ti.name()
                                             })
                                            .unwrap()
                                            .def_id())
index 945345425b3911759299669b356d701f13683c59..496838c9e84f23ecbd1a253fd9173356fc3afa36 100644 (file)
@@ -59,7 +59,7 @@ fn type_is_newtype_immediate(ccx: &CrateContext, ty: ty::t) -> bool {
         ty::ty_struct(def_id, ref substs) => {
             let fields = ty::struct_fields(ccx.tcx(), def_id, substs);
             fields.len() == 1 &&
-                fields[0].ident.name ==
+                fields[0].name ==
                     token::special_idents::unnamed_field.name &&
                 type_is_immediate(ccx, fields[0].mt.ty)
         }
index 399d2a0ec28059387840019c90e58478411d4f95..2f193754c1a50624469c1cdc08608d29e411fb6b 100644 (file)
@@ -585,7 +585,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
               expr::with_field_tys(tcx, ety, Some(e.id), |discr, field_tys| {
                   let cs = field_tys.iter().enumerate()
                                     .map(|(ix, &field_ty)| {
-                      match fs.iter().find(|f| field_ty.ident.name == f.ident.node.name) {
+                      match fs.iter().find(|f| field_ty.name == f.ident.node.name) {
                           Some(ref f) => const_expr(cx, &*f.expr).val0(),
                           None => {
                               match base_val {
index f2c965924cd191b44c434ea70b2789e076bb4841..90801a4eaa39dbe457ac3ff2877f611a9e4b3664 100644 (file)
@@ -1931,10 +1931,10 @@ fn create_member_descriptions(&self, cx: &CrateContext) -> Vec<MemberDescription
         };
 
         self.fields.iter().enumerate().map(|(i, field)| {
-            let name = if field.ident.name == special_idents::unnamed_field.name {
+            let name = if field.name == special_idents::unnamed_field.name {
                 "".to_string()
             } else {
-                token::get_ident(field.ident).get().to_string()
+                token::get_name(field.name).get().to_string()
             };
 
             let offset = if self.is_simd {
@@ -2142,8 +2142,7 @@ fn create_member_descriptions(&self, cx: &CrateContext) -> Vec<MemberDescription
 
                 // First create a description of the artificial wrapper struct:
                 let non_null_variant = &(*self.variants)[non_null_variant_index as uint];
-                let non_null_variant_ident = non_null_variant.name;
-                let non_null_variant_name = token::get_ident(non_null_variant_ident);
+                let non_null_variant_name = token::get_name(non_null_variant.name);
 
                 // The llvm type and metadata of the pointer
                 let non_null_llvm_type = type_of::type_of(cx, nnty);
@@ -2188,8 +2187,7 @@ fn create_member_descriptions(&self, cx: &CrateContext) -> Vec<MemberDescription
                 // Encode the information about the null variant in the union
                 // member's name.
                 let null_variant_index = (1 - non_null_variant_index) as uint;
-                let null_variant_ident = (*self.variants)[null_variant_index].name;
-                let null_variant_name = token::get_ident(null_variant_ident);
+                let null_variant_name = token::get_name((*self.variants)[null_variant_index].name);
                 let union_member_name = format!("RUST$ENCODED$ENUM${}${}",
                                                 0u,
                                                 null_variant_name);
@@ -2230,8 +2228,7 @@ fn create_member_descriptions(&self, cx: &CrateContext) -> Vec<MemberDescription
                 // Encode the information about the null variant in the union
                 // member's name.
                 let null_variant_index = (1 - nndiscr) as uint;
-                let null_variant_ident = (*self.variants)[null_variant_index].name;
-                let null_variant_name = token::get_ident(null_variant_ident);
+                let null_variant_name = token::get_name((*self.variants)[null_variant_index].name);
                 let discrfield = match ptrfield {
                     adt::ThinPointer(field) => format!("{}", field),
                     adt::FatPointer(field, pair) => format!("{}${}", field, pair)
@@ -2307,7 +2304,7 @@ fn describe_enum_variant(cx: &CrateContext,
                       struct_def.packed);
     // Could do some consistency checks here: size, align, field count, discr type
 
-    let variant_name = token::get_ident(variant_info.name);
+    let variant_name = token::get_name(variant_info.name);
     let variant_name = variant_name.get();
     let unique_type_id = debug_context(cx).type_map
                                           .borrow_mut()
@@ -2377,7 +2374,7 @@ fn prepare_enum_metadata(cx: &CrateContext,
     let enumerators_metadata: Vec<DIDescriptor> = variants
         .iter()
         .map(|v| {
-            token::get_ident(v.name).get().with_c_str(|name| {
+            token::get_name(v.name).get().with_c_str(|name| {
                 unsafe {
                     llvm::LLVMDIBuilderCreateEnumerator(
                         DIB(cx),
index d638286a9c5bd9244db04f8bcfcc5bb04c7d6d8d..601ac18cf6af3d0794e9eb63eca725d44bacaf7c 100644 (file)
@@ -1328,7 +1328,7 @@ fn trans_struct<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         let numbered_fields = fields.iter().map(|field| {
             let opt_pos =
                 field_tys.iter().position(|field_ty|
-                                          field_ty.ident.name == field.ident.node.name);
+                                          field_ty.name == field.ident.node.name);
             match opt_pos {
                 Some(i) => {
                     *need_base.get_mut(i) = false;
index fef2ead9883d135dcef457d1b80f544a0ea7627c..a0bb16b35c7d5be67aff0d22f11153229be6f8e6 100644 (file)
@@ -300,10 +300,7 @@ fn method_with_name(ccx: &CrateContext, impl_id: ast::DefId, name: ast::Name)
                   .expect("could not find impl while translating");
     let meth_did = impl_items.iter()
                              .find(|&did| {
-                                ty::impl_or_trait_item(ccx.tcx(),
-                                                       did.def_id()).ident()
-                                                                    .name ==
-                                    name
+                                ty::impl_or_trait_item(ccx.tcx(), did.def_id()).name() == name
                              }).expect("could not find method while \
                                         translating");
 
@@ -324,13 +321,13 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             let ccx = bcx.ccx();
             let impl_did = vtable_impl.impl_def_id;
             let mname = match ty::trait_item(ccx.tcx(), trait_id, n_method) {
-                ty::MethodTraitItem(method) => method.ident,
+                ty::MethodTraitItem(method) => method.name,
                 ty::TypeTraitItem(_) => {
                     bcx.tcx().sess.bug("can't monomorphize an associated \
                                         type")
                 }
             };
-            let mth_id = method_with_name(bcx.ccx(), impl_did, mname.name);
+            let mth_id = method_with_name(bcx.ccx(), impl_did, mname);
 
             // create a concatenated set of substitutions which includes
             // those from the impl and those from the method:
@@ -703,10 +700,10 @@ fn emit_vtable_methods(bcx: Block,
     let trait_item_def_ids = ty::trait_item_def_ids(tcx, trt_id);
     trait_item_def_ids.iter().flat_map(|method_def_id| {
         let method_def_id = method_def_id.def_id();
-        let ident = ty::impl_or_trait_item(tcx, method_def_id).ident();
+        let name = ty::impl_or_trait_item(tcx, method_def_id).name();
         // The substitutions we have are on the impl, so we grab
         // the method type from the impl to substitute into.
-        let m_id = method_with_name(ccx, impl_id, ident.name);
+        let m_id = method_with_name(ccx, impl_id, name);
         let ti = ty::impl_or_trait_item(tcx, m_id);
         match ti {
             ty::MethodTraitItem(m) => {
@@ -717,7 +714,7 @@ fn emit_vtable_methods(bcx: Block,
                    ty::type_has_self(ty::mk_bare_fn(tcx, m.fty.clone())) {
                     debug!("(making impl vtable) method has self or type \
                             params: {}",
-                           token::get_ident(ident));
+                           token::get_name(name));
                     Some(C_null(Type::nil(ccx).ptr_to())).into_iter()
                 } else {
                     let mut fn_ref = trans_fn_ref_with_substs(
index a7ce93279bd8348b15ce67ec1c6d91673d3d2cbf..8ac655fe47ad8b11455401d1147708a0e9e675b6 100644 (file)
@@ -65,7 +65,7 @@
 
 #[deriving(PartialEq, Eq, Hash)]
 pub struct field {
-    pub ident: ast::Ident,
+    pub name: ast::Name,
     pub mt: mt
 }
 
@@ -107,10 +107,10 @@ pub fn def_id(&self) -> ast::DefId {
         }
     }
 
-    pub fn ident(&self) -> ast::Ident {
+    pub fn name(&self) -> ast::Name {
         match *self {
-            MethodTraitItem(ref method) => method.ident,
-            TypeTraitItem(ref associated_type) => associated_type.ident,
+            MethodTraitItem(ref method) => method.name,
+            TypeTraitItem(ref associated_type) => associated_type.name,
         }
     }
 
@@ -146,7 +146,7 @@ pub fn def_id(&self) -> ast::DefId {
 
 #[deriving(Clone, Show)]
 pub struct Method {
-    pub ident: ast::Ident,
+    pub name: ast::Name,
     pub generics: ty::Generics,
     pub fty: BareFnTy,
     pub explicit_self: ExplicitSelfCategory,
@@ -159,7 +159,7 @@ pub struct Method {
 }
 
 impl Method {
-    pub fn new(ident: ast::Ident,
+    pub fn new(name: ast::Name,
                generics: ty::Generics,
                fty: BareFnTy,
                explicit_self: ExplicitSelfCategory,
@@ -169,7 +169,7 @@ pub fn new(ident: ast::Ident,
                provided_source: Option<ast::DefId>)
                -> Method {
        Method {
-            ident: ident,
+            name: name,
             generics: generics,
             fty: fty,
             explicit_self: explicit_self,
@@ -190,7 +190,7 @@ pub fn container_id(&self) -> ast::DefId {
 
 #[deriving(Clone)]
 pub struct AssociatedType {
-    pub ident: ast::Ident,
+    pub name: ast::Name,
     pub vis: ast::Visibility,
     pub def_id: ast::DefId,
     pub container: ImplOrTraitItemContainer,
@@ -1205,7 +1205,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 #[deriving(Clone, Show)]
 pub struct TypeParameterDef {
-    pub ident: ast::Ident,
+    pub name: ast::Name,
     pub def_id: ast::DefId,
     pub space: subst::ParamSpace,
     pub index: uint,
@@ -3746,18 +3746,18 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
 pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
                      -> uint {
     let mut i = 0u;
-    for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; }
+    for f in fields.iter() { if f.name == name { return i; } i += 1u; }
     tcx.sess.bug(format!(
         "no field named `{}` found in the list of fields `{}`",
         token::get_name(name),
         fields.iter()
-              .map(|f| token::get_ident(f.ident).get().to_string())
+              .map(|f| token::get_name(f.name).get().to_string())
               .collect::<Vec<String>>()).as_slice());
 }
 
-pub fn impl_or_trait_item_idx(id: ast::Ident, trait_items: &[ImplOrTraitItem])
+pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
                               -> Option<uint> {
-    trait_items.iter().position(|m| m.ident() == id)
+    trait_items.iter().position(|m| m.name() == id)
 }
 
 pub fn ty_sort_string(cx: &ctxt, t: t) -> String {
@@ -4119,7 +4119,7 @@ pub fn associated_type_parameter_index(cx: &ctxt,
 pub struct AssociatedTypeInfo {
     pub def_id: ast::DefId,
     pub index: uint,
-    pub ident: ast::Ident,
+    pub name: ast::Name,
 }
 
 impl PartialOrd for AssociatedTypeInfo {
@@ -4222,7 +4222,7 @@ pub struct VariantInfo {
     pub args: Vec<t>,
     pub arg_names: Option<Vec<ast::Ident> >,
     pub ctor_ty: t,
-    pub name: ast::Ident,
+    pub name: ast::Name,
     pub id: ast::DefId,
     pub disr_val: Disr,
     pub vis: Visibility
@@ -4250,7 +4250,7 @@ pub fn from_ast_variant(cx: &ctxt,
                     args: arg_tys,
                     arg_names: None,
                     ctor_ty: ctor_ty,
-                    name: ast_variant.node.name,
+                    name: ast_variant.node.name.name,
                     id: ast_util::local_def(ast_variant.node.id),
                     disr_val: discriminant,
                     vis: ast_variant.node.vis
@@ -4275,7 +4275,7 @@ pub fn from_ast_variant(cx: &ctxt,
                     args: arg_tys,
                     arg_names: Some(arg_names),
                     ctor_ty: ctor_ty,
-                    name: ast_variant.node.name,
+                    name: ast_variant.node.name.name,
                     id: ast_util::local_def(ast_variant.node.id),
                     disr_val: discriminant,
                     vis: ast_variant.node.vis
@@ -4578,8 +4578,7 @@ pub fn struct_fields(cx: &ctxt, did: ast::DefId, substs: &Substs)
                      -> Vec<field> {
     lookup_struct_fields(cx, did).iter().map(|f| {
        field {
-            // FIXME #6993: change type of field to Name and get rid of new()
-            ident: ast::Ident::new(f.name),
+            name: f.name,
             mt: mt {
                 ty: lookup_field_type(cx, did, f.id, substs),
                 mutbl: MutImmutable
@@ -4593,8 +4592,7 @@ pub fn struct_fields(cx: &ctxt, did: ast::DefId, substs: &Substs)
 pub fn tup_fields(v: &[t]) -> Vec<field> {
     v.iter().enumerate().map(|(i, &f)| {
        field {
-            // FIXME #6993: change type of field to Name and get rid of new()
-            ident: ast::Ident::new(token::intern(i.to_string().as_slice())),
+            name: token::intern(i.to_string().as_slice()),
             mt: mt {
                 ty: f,
                 mutbl: MutImmutable
@@ -5084,12 +5082,12 @@ pub fn trait_item_of_item(tcx: &ctxt, def_id: ast::DefId)
         Some(m) => m.clone(),
         None => return None,
     };
-    let name = impl_item.ident().name;
+    let name = impl_item.name();
     match trait_of_item(tcx, def_id) {
         Some(trait_did) => {
             let trait_items = ty::trait_items(tcx, trait_did);
             trait_items.iter()
-                .position(|m| m.ident().name == name)
+                .position(|m| m.name() == name)
                 .map(|idx| ty::trait_item(tcx, trait_did, idx).id())
         }
         None => None
index e94764b0d0032b00178b489c800a0a09a89e6048..157f590a612e2ad2d30f510bfe06834342429ceb 100644 (file)
@@ -324,7 +324,7 @@ fn fold_with<'tcx, F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::ParamBound
 impl TypeFoldable for ty::TypeParameterDef {
     fn fold_with<'tcx, F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::TypeParameterDef {
         ty::TypeParameterDef {
-            ident: self.ident,
+            name: self.name,
             def_id: self.def_id,
             space: self.space,
             index: self.index,
index 4560c5194649410e769d79f98de7a3972b2d211a..4fb71c5c21bb779399cd90b5e9c7d5449c9bb3f7 100644 (file)
@@ -543,7 +543,7 @@ fn push_extension_candidate(&mut self, trait_def_id: DefId) {
             ty::trait_items(self.tcx(), trait_def_id);
         let matching_index =
             trait_items.iter()
-                       .position(|item| item.ident().name == self.m_name);
+                       .position(|item| item.name() == self.m_name);
         let matching_index = match matching_index {
             Some(i) => i,
             None => { return; }
@@ -1700,7 +1700,7 @@ fn trait_method(tcx: &ty::ctxt,
     trait_items
         .iter()
         .enumerate()
-        .find(|&(_, ref item)| item.ident().name == method_name)
+        .find(|&(_, ref item)| item.name() == method_name)
         .and_then(|(idx, item)| item.as_opt_method().map(|m| (idx, m)))
 }
 
@@ -1714,7 +1714,7 @@ fn impl_method(tcx: &ty::ctxt,
     impl_items
         .iter()
         .map(|&did| ty::impl_or_trait_item(tcx, did.def_id()))
-        .find(|m| m.ident().name == method_name)
+        .find(|m| m.name() == method_name)
         .and_then(|item| item.as_opt_method())
 }
 
index 5f7b31e573adedad4ccc1e554de5bd66ddecf34d..bbf6382ec86225b0d751d9a219d791487203bd92 100644 (file)
@@ -761,8 +761,7 @@ fn check_impl_items_against_trait(ccx: &CrateCtxt,
                 let opt_trait_method_ty =
                     trait_items.iter()
                                .find(|ti| {
-                                   ti.ident().name == impl_item_ty.ident()
-                                                                  .name
+                                   ti.name() == impl_item_ty.name()
                                });
                 match opt_trait_method_ty {
                     Some(trait_method_ty) => {
@@ -784,8 +783,8 @@ fn check_impl_items_against_trait(ccx: &CrateCtxt,
                                              format!("item `{}` is of a \
                                                       different kind from \
                                                       its trait `{}`",
-                                                     token::get_ident(
-                                                        impl_item_ty.ident()),
+                                                     token::get_name(
+                                                        impl_item_ty.name()),
                                                      pprust::path_to_string(
                                                         &ast_trait_ref.path))
                                              .as_slice());
@@ -799,7 +798,7 @@ fn check_impl_items_against_trait(ccx: &CrateCtxt,
                             impl_method.span,
                             format!(
                                 "method `{}` is not a member of trait `{}`",
-                                token::get_ident(impl_item_ty.ident()),
+                                token::get_name(impl_item_ty.name()),
                                 pprust::path_to_string(
                                     &ast_trait_ref.path)).as_slice());
                     }
@@ -815,7 +814,7 @@ fn check_impl_items_against_trait(ccx: &CrateCtxt,
                 let opt_associated_type =
                     trait_items.iter()
                                .find(|ti| {
-                                   ti.ident().name == typedef_ty.ident().name
+                                   ti.name() == typedef_ty.name()
                                });
                 match opt_associated_type {
                     Some(associated_type) => {
@@ -830,8 +829,8 @@ fn check_impl_items_against_trait(ccx: &CrateCtxt,
                                              format!("item `{}` is of a \
                                                       different kind from \
                                                       its trait `{}`",
-                                                     token::get_ident(
-                                                        typedef_ty.ident()),
+                                                     token::get_name(
+                                                        typedef_ty.name()),
                                                      pprust::path_to_string(
                                                         &ast_trait_ref.path))
                                              .as_slice());
@@ -846,7 +845,7 @@ fn check_impl_items_against_trait(ccx: &CrateCtxt,
                             format!(
                                 "associated type `{}` is not a member of \
                                  trait `{}`",
-                                token::get_ident(typedef_ty.ident()),
+                                token::get_name(typedef_ty.name()),
                                 pprust::path_to_string(
                                     &ast_trait_ref.path)).as_slice());
                     }
@@ -866,33 +865,29 @@ trait `{}`",
                     impl_items.iter().any(|ii| {
                         match *ii {
                             ast::MethodImplItem(ref m) => {
-                                m.pe_ident().name == trait_method.ident.name
+                                m.pe_ident().name == trait_method.name
                             }
                             ast::TypeImplItem(_) => false,
                         }
                     });
                 let is_provided =
                     provided_methods.iter().any(
-                        |m| m.ident.name == trait_method.ident.name);
+                        |m| m.name == trait_method.name);
                 if !is_implemented && !is_provided {
-                    missing_methods.push(
-                        format!("`{}`",
-                                token::get_ident(trait_method.ident)));
+                    missing_methods.push(format!("`{}`", token::get_name(trait_method.name)));
                 }
             }
             ty::TypeTraitItem(ref associated_type) => {
                 let is_implemented = impl_items.iter().any(|ii| {
                     match *ii {
                         ast::TypeImplItem(ref typedef) => {
-                            typedef.ident.name == associated_type.ident.name
+                            typedef.ident.name == associated_type.name
                         }
                         ast::MethodImplItem(_) => false,
                     }
                 });
                 if !is_implemented {
-                    missing_methods.push(
-                        format!("`{}`",
-                                token::get_ident(associated_type.ident)));
+                    missing_methods.push(format!("`{}`", token::get_name(associated_type.name)));
                 }
             }
         }
@@ -943,7 +938,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 impl_m_span,
                 format!("method `{}` has a `{}` declaration in the impl, \
                         but not in the trait",
-                        token::get_ident(trait_m.ident),
+                        token::get_name(trait_m.name),
                         ppaux::explicit_self_category_to_str(
                             &impl_m.explicit_self)).as_slice());
             return;
@@ -953,7 +948,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 impl_m_span,
                 format!("method `{}` has a `{}` declaration in the trait, \
                         but not in the impl",
-                        token::get_ident(trait_m.ident),
+                        token::get_name(trait_m.name),
                         ppaux::explicit_self_category_to_str(
                             &trait_m.explicit_self)).as_slice());
             return;
@@ -969,7 +964,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
         span_err!(tcx.sess, impl_m_span, E0049,
             "method `{}` has {} type parameter{} \
              but its trait declaration has {} type parameter{}",
-            token::get_ident(trait_m.ident),
+            token::get_name(trait_m.name),
             num_impl_m_type_params,
             if num_impl_m_type_params == 1 {""} else {"s"},
             num_trait_m_type_params,
@@ -981,7 +976,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
         span_err!(tcx.sess, impl_m_span, E0050,
             "method `{}` has {} parameter{} \
              but the declaration in trait `{}` has {}",
-            token::get_ident(trait_m.ident),
+            token::get_name(trait_m.name),
             impl_m.fty.sig.inputs.len(),
             if impl_m.fty.sig.inputs.len() == 1 {""} else {"s"},
             ty::item_path_str(tcx, trait_m.def_id),
@@ -1082,7 +1077,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 "in method `{}`, type parameter {} requires `{}`, \
                  which is not required by the corresponding type parameter \
                  in the trait declaration",
-                token::get_ident(trait_m.ident),
+                token::get_name(trait_m.name),
                 i,
                 extra_bounds.user_string(tcx));
            return;
@@ -1121,7 +1116,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 span_err!(tcx.sess, impl_m_span, E0052,
                     "in method `{}`, type parameter {} requires bound `{}`, which is not \
                      required by the corresponding type parameter in the trait declaration",
-                    token::get_ident(trait_m.ident),
+                    token::get_name(trait_m.name),
                     i,
                     ppaux::trait_ref_to_string(tcx, &*impl_trait_bound));
             }
@@ -1152,7 +1147,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
         Err(ref terr) => {
             span_err!(tcx.sess, impl_m_span, E0053,
                 "method `{}` has an incompatible type for trait: {}",
-                token::get_ident(trait_m.ident),
+                token::get_name(trait_m.name),
                 ty::type_err_to_str(tcx, terr));
             ty::note_and_explain_type_err(tcx, terr);
         }
@@ -1228,7 +1223,7 @@ fn method2<'b>() { .. case 2, could be ok .. }
                 span,
                 format!("lifetime parameters or bounds on method `{}` do \
                          not match the trait declaration",
-                        token::get_ident(impl_m.ident)).as_slice());
+                        token::get_name(impl_m.name)).as_slice());
             return false;
         }
 
@@ -3836,8 +3831,8 @@ fn check_struct_fields_on_error(fcx: &FnCtxt,
                                     ty::ty_struct(did, ref substs) => {
                                         let fields = ty::struct_fields(fcx.tcx(), did, substs);
                                         fields.len() == 1
-                                        && fields[0].ident ==
-                                        token::special_idents::unnamed_field
+                                        && fields[0].name ==
+                                        token::special_idents::unnamed_field.name
                                     }
                                     _ => false
                                 };
index 7906e0101ee16d1acb3804f31248571fc1f7d4f7..cb4e878c22cc30b0e5ae4067cef53cd509c4d376 100644 (file)
@@ -539,7 +539,7 @@ fn subst_receiver_types_in_method_ty(tcx: &ty::ctxt,
            method.fty.repr(tcx));
 
     ty::Method::new(
-        method.ident,
+        method.name,
         method_generics,
         method_fty,
         method.explicit_self,
index 2ffb90861bf3381b4d99078f149bcb7527d350f5..273518195b5618e4b0d3488d57a2d42e729f2fd6 100644 (file)
@@ -279,7 +279,7 @@ fn collect_trait_methods(ccx: &CrateCtxt,
                                             &trait_def.generics,
                                             trait_items.as_slice(),
                                             &m.id,
-                                            &m.ident,
+                                            &m.ident.name,
                                             &m.explicit_self,
                                             m.abi,
                                             &m.generics,
@@ -293,7 +293,7 @@ fn collect_trait_methods(ccx: &CrateCtxt,
                                             &trait_def.generics,
                                             trait_items.as_slice(),
                                             &m.id,
-                                            &m.pe_ident(),
+                                            &m.pe_ident().name,
                                             m.pe_explicit_self(),
                                             m.pe_abi(),
                                             m.pe_generics(),
@@ -318,7 +318,7 @@ fn collect_trait_methods(ccx: &CrateCtxt,
                             ast::TypeTraitItem(ref ast_associated_type) => {
                                 let trait_did = local_def(trait_id);
                                 let associated_type = ty::AssociatedType {
-                                    ident: ast_associated_type.ident,
+                                    name: ast_associated_type.ident.name,
                                     vis: ast::Public,
                                     def_id: local_def(ast_associated_type.id),
                                     container: TraitContainer(trait_did),
@@ -376,7 +376,7 @@ fn ty_method_of_trait_method(ccx: &CrateCtxt,
                                  trait_generics: &ty::Generics,
                                  trait_items: &[ast::TraitItem],
                                  m_id: &ast::NodeId,
-                                 m_ident: &ast::Ident,
+                                 m_name: &ast::Name,
                                  m_explicit_self: &ast::ExplicitSelf,
                                  m_abi: abi::Abi,
                                  m_generics: &ast::Generics,
@@ -409,7 +409,7 @@ fn ty_method_of_trait_method(ccx: &CrateCtxt,
         };
 
         ty::Method::new(
-            *m_ident,
+            *m_name,
             ty_generics,
             fty,
             explicit_self_category,
@@ -489,7 +489,7 @@ fn convert_associated_type(ccx: &CrateCtxt,
     write_ty_to_tcx(ccx.tcx, associated_type.id, param_type);
 
     let associated_type = Rc::new(ty::AssociatedType {
-        ident: associated_type.ident,
+        name: associated_type.ident.name,
         vis: ast::Public,
         def_id: local_def(associated_type.id),
         container: TraitContainer(trait_def.trait_ref.def_id),
@@ -629,7 +629,7 @@ fn ty_of_method(ccx: &CrateCtxt,
         // foo(); }`).
         let method_vis = m.pe_vis().inherit_from(rcvr_visibility);
 
-        ty::Method::new(m.pe_ident(),
+        ty::Method::new(m.pe_ident().name,
                         m_ty_generics,
                         fty,
                         explicit_self_category,
@@ -806,10 +806,8 @@ fn associated_type_binding(&self,
                     match *impl_item {
                         ast::MethodImplItem(_) => {}
                         ast::TypeImplItem(ref typedef) => {
-                            if associated_type.ident().name == typedef.ident
-                                                                      .name {
-                                return self.ccx.to_ty(&ExplicitRscope,
-                                                      &*typedef.typ)
+                            if associated_type.name() == typedef.ident.name {
+                                return self.ccx.to_ty(&ExplicitRscope, &*typedef.typ)
                             }
                         }
                     }
@@ -1145,7 +1143,7 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::Item) {
                         write_ty_to_tcx(ccx.tcx, typedef.id, typ);
 
                         let associated_type = Rc::new(ty::AssociatedType {
-                            ident: typedef.ident,
+                            name: typedef.ident.name,
                             vis: typedef.vis,
                             def_id: local_def(typedef.id),
                             container: ty::ImplContainer(local_def(it.id)),
@@ -1685,7 +1683,7 @@ fn ty_generics_for_trait(ccx: &CrateCtxt,
                 let def = ty::TypeParameterDef {
                     space: subst::TypeSpace,
                     index: generics.types.len(subst::TypeSpace),
-                    ident: associated_type.ident,
+                    name: associated_type.ident.name,
                     def_id: local_def(associated_type.id),
                     bounds: ty::ParamBounds {
                         builtin_bounds: ty::empty_builtin_bounds(),
@@ -1716,7 +1714,7 @@ fn ty_generics_for_trait(ccx: &CrateCtxt,
     let def = ty::TypeParameterDef {
         space: subst::SelfSpace,
         index: 0,
-        ident: special_idents::type_self,
+        name: special_idents::type_self.name,
         def_id: local_def(param_id),
         bounds: ty::ParamBounds {
             region_bounds: vec!(),
@@ -1817,7 +1815,7 @@ fn ensure_associated_types<'tcx,AC>(this: &AC, trait_id: ast::DefId)
                                     let info = ty::AssociatedTypeInfo {
                                         def_id: local_def(associated_type.id),
                                         index: index,
-                                        ident: associated_type.ident,
+                                        name: associated_type.ident.name,
                                     };
                                     result.push(info);
                                     index += 1;
@@ -1855,7 +1853,7 @@ fn ensure_associated_types<'tcx,AC>(this: &AC, trait_id: ast::DefId)
                 let info = ty::AssociatedTypeInfo {
                     def_id: associated_type.def_id,
                     index: index,
-                    ident: associated_type.ident
+                    name: associated_type.name
                 };
                 result.push(info);
                 index += 1;
@@ -1920,10 +1918,8 @@ fn ty_generics<'tcx,AC>(this: &AC,
                                                 this.tcx(),
                                                 associated_type_info.def_id);
                                         let def = ty::TypeParameterDef {
-                                            ident: associated_type_trait_item
-                                                       .ident(),
-                                            def_id:
-                                                associated_type_info.def_id,
+                                            name: associated_type_trait_item.name(),
+                                            def_id: associated_type_info.def_id,
                                             space: space,
                                             index: types.len() + index,
                                             bounds: ty::ParamBounds {
@@ -2033,7 +2029,7 @@ fn get_or_create_type_parameter_def<'tcx,AC>(
         let def = ty::TypeParameterDef {
             space: space,
             index: index,
-            ident: param.ident,
+            name: param.ident.name,
             def_id: local_def(param.id),
             associated_with: None,
             bounds: bounds,
index a20a988c881dd3798f00c76a319c84ad30e4e188..81deae86faa4849c32f8e2594e7861665d539bc8 100644 (file)
@@ -891,9 +891,9 @@ fn repr(&self, _: &ctxt) -> String {
 
 impl Repr for ty::Method {
     fn repr(&self, tcx: &ctxt) -> String {
-        format!("method(ident: {}, generics: {}, fty: {}, \
+        format!("method(name: {}, generics: {}, fty: {}, \
                  explicit_self: {}, vis: {}, def_id: {})",
-                self.ident.repr(tcx),
+                self.name.repr(tcx),
                 self.generics.repr(tcx),
                 self.fty.repr(tcx),
                 self.explicit_self.repr(tcx),
@@ -1214,7 +1214,7 @@ fn user_string(&self, tcx: &ctxt) -> String {
         let id = self.idx;
         let did = self.def_id;
         let ident = match tcx.ty_param_defs.borrow().find(&did.node) {
-            Some(def) => token::get_ident(def.ident).get().to_string(),
+            Some(def) => token::get_name(def.name).get().to_string(),
 
             // This can only happen when a type mismatch error happens and
             // the actual type has more type parameters than the expected one.
index 102ba5820fe2fd01279b1146d6a9d92bab9b3d66..ca79044e7f56d9eb3d4be5a4e664598cba5c37c3 100644 (file)
@@ -463,10 +463,9 @@ fn clean(&self, cx: &DocContext) -> TyParam {
 impl Clean<TyParam> for ty::TypeParameterDef {
     fn clean(&self, cx: &DocContext) -> TyParam {
         cx.external_typarams.borrow_mut().as_mut().unwrap()
-          .insert(self.def_id, self.ident.clean(cx));
-
+          .insert(self.def_id, self.name.clean(cx));
         TyParam {
-            name: self.ident.clean(cx),
+            name: self.name.clean(cx),
             did: self.def_id,
             bounds: self.bounds.clean(cx),
             default: self.default.clean(cx)
@@ -1056,7 +1055,7 @@ fn clean(&self, cx: &DocContext) -> Item {
         };
 
         Item {
-            name: Some(self.ident.clean(cx)),
+            name: Some(self.name.clean(cx)),
             visibility: Some(ast::Inherited),
             stability: get_stability(cx, self.def_id),
             def_id: self.def_id,
@@ -2211,7 +2210,7 @@ impl Clean<Item> for ty::AssociatedType {
     fn clean(&self, cx: &DocContext) -> Item {
         Item {
             source: DUMMY_SP.clean(cx),
-            name: Some(self.ident.clean(cx)),
+            name: Some(self.name.clean(cx)),
             attrs: Vec::new(),
             inner: AssociatedTypeItem,
             visibility: None,