diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index acc0aab659d5a..5419ed3791b0b 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -337,12 +337,12 @@ impl Session_ { } // pointless function, now... - pub fn str_of(@self, id: ast::ident) -> @str { + pub fn str_of(@self, id: ast::Ident) -> @str { token::ident_to_str(&id) } // pointless function, now... - pub fn ident_of(@self, st: &str) -> ast::ident { + pub fn ident_of(@self, st: &str) -> ast::Ident { token::str_to_ident(st) } diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 906aa619fa3e3..e0914bcec6eaa 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -30,7 +30,7 @@ type node_id_gen = @fn() -> ast::NodeId; struct Test { span: Span, - path: ~[ast::ident], + path: ~[ast::Ident], bench: bool, ignore: bool, should_fail: bool @@ -39,7 +39,7 @@ struct Test { struct TestCtxt { sess: session::Session, crate: @ast::Crate, - path: ~[ast::ident], + path: ~[ast::Ident], ext_cx: @ExtCtxt, testfns: ~[Test] } @@ -383,7 +383,7 @@ fn nospan(t: T) -> codemap::Spanned { codemap::Spanned { node: t, span: dummy_sp() } } -fn path_node(ids: ~[ast::ident]) -> ast::Path { +fn path_node(ids: ~[ast::Ident]) -> ast::Path { ast::Path { span: dummy_sp(), global: false, @@ -395,7 +395,7 @@ fn path_node(ids: ~[ast::ident]) -> ast::Path { } } -fn path_node_global(ids: ~[ast::ident]) -> ast::Path { +fn path_node_global(ids: ~[ast::Ident]) -> ast::Path { ast::Path { span: dummy_sp(), global: true, diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 198c41539cb6e..a1a07d8bf3f84 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -25,7 +25,7 @@ use syntax::ast_map; use syntax::diagnostic::expect; pub struct StaticMethodInfo { - ident: ast::ident, + ident: ast::Ident, def_id: ast::def_id, purity: ast::purity } @@ -52,7 +52,7 @@ pub fn each_lang_item(cstore: @mut cstore::CStore, /// Iterates over each child of the given item. pub fn each_child_of_item(cstore: @mut cstore::CStore, def_id: ast::def_id, - callback: &fn(decoder::DefLike, ast::ident)) { + callback: &fn(decoder::DefLike, ast::Ident)) { let crate_data = cstore::get_crate_data(cstore, def_id.crate); let get_crate_data: decoder::GetCrateDataCb = |cnum| { cstore::get_crate_data(cstore, cnum) @@ -68,7 +68,7 @@ pub fn each_child_of_item(cstore: @mut cstore::CStore, pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore, cnum: ast::CrateNum, callback: &fn(decoder::DefLike, - ast::ident)) { + ast::Ident)) { let crate_data = cstore::get_crate_data(cstore, cnum); let get_crate_data: decoder::GetCrateDataCb = |cnum| { cstore::get_crate_data(cstore, cnum) @@ -129,7 +129,7 @@ pub fn get_method(tcx: ty::ctxt, def: ast::def_id) -> ty::Method { pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore, def: ast::def_id) - -> (ast::ident, ast::explicit_self_) + -> (ast::Ident, ast::explicit_self_) { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_method_name_and_explicit_self(cstore.intr, cdata, def.node) @@ -156,7 +156,7 @@ pub fn get_supertraits(tcx: ty::ctxt, def: ast::def_id) -> ~[@ty::TraitRef] { } pub fn get_type_name_if_impl(cstore: @mut cstore::CStore, def: ast::def_id) - -> Option { + -> Option { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_type_name_if_impl(cdata, def.node) } @@ -245,7 +245,7 @@ pub fn get_impl_vtables(tcx: ty::ctxt, pub fn get_impl_method(cstore: @mut cstore::CStore, def: ast::def_id, - mname: ast::ident) + mname: ast::Ident) -> Option { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_impl_method(cstore.intr, cdata, def.node, mname) diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 592ee1b0a6338..0200ca49bad9a 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -312,12 +312,12 @@ fn item_path(item_doc: ebml::Doc) -> ast_map::path { return result; } -fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident { +fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::Ident { 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::new_ident(val), + Some(val) => ast::Ident::new(val), } } @@ -452,7 +452,7 @@ pub fn get_impl_vtables(cdata: Cmd, pub fn get_impl_method(intr: @ident_interner, cdata: Cmd, id: ast::NodeId, - name: ast::ident) -> Option { + name: ast::Ident) -> Option { let items = reader::get_doc(reader::Doc(cdata.data), tag_items); let mut found = None; do reader::tagged_docs(find_item(id, items), tag_item_impl_method) |mid| { @@ -706,7 +706,7 @@ fn each_child_of_item_or_crate(intr: @ident_interner, cdata: Cmd, item_doc: ebml::Doc, get_crate_data: GetCrateDataCb, - callback: &fn(DefLike, ast::ident)) { + callback: &fn(DefLike, ast::Ident)) { // Iterate over all children. let _ = do reader::tagged_docs(item_doc, tag_mod_child) |child_info_doc| { let child_def_id = reader::with_doc_data(child_info_doc, @@ -829,7 +829,7 @@ pub fn each_child_of_item(intr: @ident_interner, cdata: Cmd, id: ast::NodeId, get_crate_data: GetCrateDataCb, - callback: &fn(DefLike, ast::ident)) { + callback: &fn(DefLike, ast::Ident)) { // Find the item. let root_doc = reader::Doc(cdata.data); let items = reader::get_doc(root_doc, tag_items); @@ -849,7 +849,7 @@ pub fn each_child_of_item(intr: @ident_interner, pub fn each_top_level_item_of_crate(intr: @ident_interner, cdata: Cmd, get_crate_data: GetCrateDataCb, - callback: &fn(DefLike, ast::ident)) { + callback: &fn(DefLike, ast::Ident)) { let root_doc = reader::Doc(cdata.data); let misc_info_doc = reader::get_doc(root_doc, tag_misc_info); let crate_items_doc = reader::get_doc(misc_info_doc, @@ -995,7 +995,7 @@ pub fn get_impl(intr: @ident_interner, cdata: Cmd, impl_id: ast::NodeId, pub fn get_method_name_and_explicit_self( intr: @ident_interner, cdata: Cmd, - id: ast::NodeId) -> (ast::ident, ast::explicit_self_) + id: ast::NodeId) -> (ast::Ident, ast::explicit_self_) { let method_doc = lookup_item(id, cdata.data); let name = item_name(intr, method_doc); @@ -1093,7 +1093,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 { + node_id: ast::NodeId) -> Option { let item = lookup_item(node_id, cdata.data); if item_family(item) != Impl { return None; @@ -1352,7 +1352,7 @@ pub fn get_crate_attributes(data: @~[u8]) -> ~[ast::Attribute] { #[deriving(Clone)] pub struct CrateDep { cnum: ast::CrateNum, - name: ast::ident, + name: ast::Ident, vers: @str, hash: @str } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index c6efeaec9b334..d2ad788964994 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -102,13 +102,13 @@ pub fn reachable(ecx: &EncodeContext, id: NodeId) -> bool { fn encode_name(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, - name: ident) { + name: Ident) { ebml_w.wr_tagged_str(tag_paths_data_name, ecx.tcx.sess.str_of(name)); } fn encode_impl_type_basename(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, - name: ident) { + name: Ident) { ebml_w.wr_tagged_str(tag_item_impl_type_basename, ecx.tcx.sess.str_of(name)); } @@ -135,9 +135,9 @@ struct entry { } fn add_to_index(ebml_w: &mut writer::Encoder, - path: &[ident], + path: &[Ident], index: &mut ~[entry<~str>], - name: ident) { + name: Ident) { let mut full_path = ~[]; full_path.push_all(path); full_path.push(name); @@ -379,7 +379,7 @@ fn encode_reexported_static_method(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, exp: &middle::resolve::Export2, method_def_id: def_id, - method_ident: ident) { + method_ident: Ident) { debug!("(encode reexported static method) %s::%s", exp.name, ecx.tcx.sess.str_of(method_ident)); ebml_w.start_tag(tag_items_data_item_reexport); @@ -541,7 +541,7 @@ fn encode_info_for_mod(ecx: &EncodeContext, md: &_mod, id: NodeId, path: &[ast_map::path_elt], - name: ident, + name: Ident, vis: visibility) { ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(id)); @@ -700,7 +700,7 @@ fn encode_info_for_struct(ecx: &EncodeContext, fn encode_info_for_struct_ctor(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, path: &[ast_map::path_elt], - name: ast::ident, + name: ast::Ident, ctor_id: NodeId, index: @mut ~[entry]) { index.push(entry { val: ctor_id as i64, pos: ebml_w.writer.tell() }); diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index f5bad88b1ca66..3e520522ba5ad 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -90,13 +90,13 @@ fn scan(st: &mut PState, is_last: &fn(char) -> bool, return op(st.data.slice(start_pos, end_pos)); } -pub fn parse_ident(st: &mut PState, last: char) -> ast::ident { +pub fn parse_ident(st: &mut PState, last: char) -> ast::Ident { fn is_last(b: char, c: char) -> bool { return c == b; } return parse_ident_(st, |a| is_last(last, a) ); } fn parse_ident_(st: &mut PState, is_last: @fn(char) -> bool) -> - ast::ident { + ast::Ident { let rslt = scan(st, is_last, str::from_bytes); return st.tcx.sess.ident_of(rslt); } @@ -130,7 +130,7 @@ pub fn parse_trait_ref_data(data: &[u8], crate_num: int, pos: uint, tcx: ty::ctx } fn parse_path(st: &mut PState) -> @ast::Path { - let mut idents: ~[ast::ident] = ~[]; + let mut idents: ~[ast::Ident] = ~[]; fn is_last(c: char) -> bool { return c == '(' || c == ':'; } idents.push(parse_ident_(st, is_last)); loop { diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index e38ac4feb9cef..faf4ac76a039d 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -1256,7 +1256,7 @@ trait fake_ext_ctxt { fn cfg(&self) -> ast::CrateConfig; fn parse_sess(&self) -> @mut parse::ParseSess; fn call_site(&self) -> Span; - fn ident_of(&self, st: &str) -> ast::ident; + fn ident_of(&self, st: &str) -> ast::Ident; } #[cfg(test)] @@ -1273,7 +1273,7 @@ impl fake_ext_ctxt for fake_session { expn_info: None } } - fn ident_of(&self, st: &str) -> ast::ident { + fn ident_of(&self, st: &str) -> ast::Ident { token::str_to_ident(st) } } diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs index 282292a2ac09c..a8de2c9e77325 100644 --- a/src/librustc/middle/cfg/construct.rs +++ b/src/librustc/middle/cfg/construct.rs @@ -488,7 +488,7 @@ impl CFGBuilder { fn find_scope(&self, expr: @ast::expr, - label: Option) -> LoopScope { + label: Option) -> LoopScope { match label { None => { return *self.loop_scopes.last(); diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 46b6d2214ae49..42dae2017bc8b 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -867,7 +867,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { fn find_scope<'a>(&self, expr: @ast::expr, - label: Option, + label: Option, loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope { let index = match label { None => { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index d60781dcc097d..1ad6e409fc364 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -1033,7 +1033,7 @@ fn lint_path_statement() -> @mut OuterLint { } fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) { - fn is_camel_case(cx: ty::ctxt, ident: ast::ident) -> bool { + fn is_camel_case(cx: ty::ctxt, ident: ast::Ident) -> bool { let ident = cx.sess.str_of(ident); assert!(!ident.is_empty()); let ident = ident.trim_chars(&'_'); @@ -1044,7 +1044,7 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) { !ident.contains_char('_') } - fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: Span) { + fn check_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) { if !is_camel_case(cx.tcx, ident) { cx.span_lint( non_camel_case_types, span, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index b79f6299e26cf..cbfab25f13371 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -227,13 +227,13 @@ enum LocalKind { struct LocalInfo { id: NodeId, - ident: ident, + ident: Ident, is_mutbl: bool, kind: LocalKind, } enum VarKind { - Arg(NodeId, ident), + Arg(NodeId, Ident), Local(LocalInfo), ImplicitRet } @@ -756,7 +756,7 @@ impl Liveness { } pub fn find_loop_scope(&self, - opt_label: Option, + opt_label: Option, id: NodeId, sp: Span) -> NodeId { diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 21a2256b55437..1fc670312f0c6 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -99,7 +99,7 @@ pub enum InteriorKind { #[deriving(Eq, IterBytes)] pub enum FieldName { - NamedField(ast::ident), + NamedField(ast::Ident), PositionalField(uint) } @@ -613,7 +613,7 @@ impl mem_categorization_ctxt { pub fn cat_field(&self, node: N, base_cmt: cmt, - f_name: ast::ident, + f_name: ast::Ident, f_ty: ty::t) -> cmt { @cmt_ { @@ -1058,7 +1058,7 @@ impl mem_categorization_ctxt { /// an enum to determine which variant is in use. pub fn field_mutbl(tcx: ty::ctxt, base_ty: ty::t, - f_name: ast::ident, + f_name: ast::Ident, node_id: ast::NodeId) -> Option { // Need to refactor so that struct/enum fields can be treated uniformly. diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs index 253d234afcfc4..a41ab09fdbb79 100644 --- a/src/librustc/middle/pat_util.rs +++ b/src/librustc/middle/pat_util.rs @@ -16,7 +16,7 @@ use syntax::ast::*; use syntax::ast_util::{path_to_ident, walk_pat}; use syntax::codemap::Span; -pub type PatIdMap = HashMap; +pub type PatIdMap = HashMap; // This is used because same-named variables in alternative patterns need to // use the NodeId of their namesake in the first pattern. diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 5fa85674f9a1a..5c7ab126c9160 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -20,7 +20,7 @@ use middle::typeck::{method_static, method_object}; use std::util::ignore; use syntax::ast::{decl_item, def, def_fn, def_id, def_static_method}; use syntax::ast::{def_variant, expr_field, expr_method_call, expr_path}; -use syntax::ast::{expr_struct, expr_unary, ident, inherited, item_enum}; +use syntax::ast::{expr_struct, expr_unary, Ident, inherited, item_enum}; use syntax::ast::{item_foreign_mod, item_fn, item_impl, item_struct}; use syntax::ast::{item_trait, LOCAL_CRATE, NodeId, pat_struct, Path}; use syntax::ast::{private, provided, public, required, stmt_decl, visibility}; @@ -203,7 +203,7 @@ impl PrivacyVisitor { } // Checks that a private field is in scope. - fn check_field(&mut self, span: Span, id: ast::def_id, ident: ast::ident) { + fn check_field(&mut self, span: Span, id: ast::def_id, ident: ast::Ident) { let fields = ty::lookup_struct_fields(self.tcx, id); for field in fields.iter() { if field.ident != ident { loop; } @@ -216,7 +216,7 @@ impl PrivacyVisitor { } // Given the ID of a method, checks to ensure it's in scope. - fn check_method_common(&mut self, span: Span, method_id: def_id, name: &ident) { + fn check_method_common(&mut self, span: Span, method_id: def_id, name: &Ident) { // If the method is a default method, we need to use the def_id of // the default implementation. // Having to do this this is really unfortunate. @@ -280,7 +280,7 @@ impl PrivacyVisitor { } // Checks that a private method is in scope. - fn check_method(&mut self, span: Span, origin: &method_origin, ident: ast::ident) { + fn check_method(&mut self, span: Span, origin: &method_origin, ident: ast::Ident) { match *origin { method_static(method_id) => { self.check_method_common(span, method_id, &ident) diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 303a534974dd5..05545862f9008 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -51,7 +51,7 @@ pub struct binding_info { } // Map from the name in a pattern to its binding mode. -pub type BindingMap = HashMap; +pub type BindingMap = HashMap; // Trait method resolution pub type TraitMap = HashMap; @@ -162,7 +162,7 @@ impl Visitor<()> for ResolveVisitor { /// Contains data for specific types of import directives. pub enum ImportDirectiveSubclass { - SingleImport(ident /* target */, ident /* source */), + SingleImport(Ident /* target */, Ident /* source */), GlobImport } @@ -311,7 +311,7 @@ pub enum DuplicateCheckingMode { /// One local scope. pub struct Rib { - bindings: @mut HashMap, + bindings: @mut HashMap, self_binding: @mut Option, kind: RibKind, } @@ -329,7 +329,7 @@ impl Rib { /// One import directive. pub struct ImportDirective { privacy: Privacy, - module_path: ~[ident], + module_path: ~[Ident], subclass: @ImportDirectiveSubclass, span: Span, id: NodeId, @@ -337,7 +337,7 @@ pub struct ImportDirective { impl ImportDirective { pub fn new(privacy: Privacy, - module_path: ~[ident], + module_path: ~[Ident], subclass: @ImportDirectiveSubclass, span: Span, id: NodeId) @@ -425,7 +425,7 @@ impl ImportResolution { /// The link from a module up to its nearest parent node. pub enum ParentLink { NoParentLink, - ModuleParentLink(@mut Module, ident), + ModuleParentLink(@mut Module, Ident), BlockParentLink(@mut Module, NodeId) } @@ -445,12 +445,12 @@ pub struct Module { def_id: Option, kind: ModuleKind, - children: @mut HashMap, + children: @mut HashMap, imports: @mut ~[@ImportDirective], // The external module children of this node that were declared with // `extern mod`. - external_module_children: @mut HashMap, + external_module_children: @mut HashMap, // The anonymous children of this node. Anonymous children are pseudo- // modules that are implicitly created around items contained within @@ -469,7 +469,7 @@ pub struct Module { anonymous_children: @mut HashMap, // The status of resolving each import in this module. - import_resolutions: @mut HashMap, + import_resolutions: @mut HashMap, // The number of unresolved globs that this module exports. glob_count: uint, @@ -759,7 +759,7 @@ pub fn NameBindings() -> NameBindings { /// Interns the names of the primitive types. pub struct PrimitiveTypeTable { - primitive_types: HashMap, + primitive_types: HashMap, } impl PrimitiveTypeTable { @@ -873,7 +873,7 @@ pub struct Resolver { graph_root: @mut NameBindings, - method_map: @mut HashMap>, + method_map: @mut HashMap>, structs: HashSet, // The number of imports that are currently unresolved. @@ -900,9 +900,9 @@ pub struct Resolver { current_trait_refs: Option<~[def_id]>, // The ident for the keyword "self". - self_ident: ident, + self_ident: Ident, // The ident for the non-keyword "Self". - type_self_ident: ident, + type_self_ident: Ident, // The idents for the primitive types. primitive_type_table: @PrimitiveTypeTable, @@ -1017,7 +1017,7 @@ impl Resolver { * a block, fails. */ pub fn add_child(@mut self, - name: ident, + name: Ident, reduced_graph_parent: ReducedGraphParent, duplicate_checking_mode: DuplicateCheckingMode, // For printing errors @@ -1153,7 +1153,7 @@ impl Resolver { return false; } - pub fn get_parent_link(@mut self, parent: ReducedGraphParent, name: ident) + pub fn get_parent_link(@mut self, parent: ReducedGraphParent, name: Ident) -> ParentLink { match parent { ModuleReducedGraphParent(module_) => { @@ -1659,7 +1659,7 @@ impl Resolver { visibility: ast::visibility, child_name_bindings: @mut NameBindings, final_ident: &str, - ident: ident, + ident: Ident, new_parent: ReducedGraphParent) { let privacy = visibility_to_privacy(visibility); match def { @@ -1783,7 +1783,7 @@ impl Resolver { fn build_reduced_graph_for_external_crate_def(@mut self, root: @mut Module, def_like: DefLike, - ident: ident) { + ident: Ident) { match def_like { DlDef(def) => { // Add the new child item, if necessary. @@ -1962,7 +1962,7 @@ impl Resolver { pub fn build_import_directive(@mut self, privacy: Privacy, module_: @mut Module, - module_path: ~[ident], + module_path: ~[Ident], subclass: @ImportDirectiveSubclass, span: Span, id: NodeId) { @@ -2107,7 +2107,7 @@ impl Resolver { } } - pub fn idents_to_str(@mut self, idents: &[ident]) -> ~str { + pub fn idents_to_str(@mut self, idents: &[Ident]) -> ~str { let mut first = true; let mut result = ~""; for ident in idents.iter() { @@ -2122,7 +2122,7 @@ impl Resolver { } fn path_idents_to_str(@mut self, path: &Path) -> ~str { - let identifiers: ~[ast::ident] = path.segments + let identifiers: ~[ast::Ident] = path.segments .iter() .map(|seg| seg.identifier) .collect(); @@ -2139,7 +2139,7 @@ impl Resolver { } pub fn import_path_to_str(@mut self, - idents: &[ident], + idents: &[Ident], subclass: ImportDirectiveSubclass) -> @str { if idents.is_empty() { @@ -2262,8 +2262,8 @@ impl Resolver { pub fn resolve_single_import(@mut self, module_: @mut Module, containing_module: @mut Module, - target: ident, - source: ident, + target: Ident, + source: Ident, directive: &ImportDirective) -> ResolveResult<()> { debug!("(resolving single import) resolving `%s` = `%s::%s` from \ @@ -2620,7 +2620,7 @@ impl Resolver { /// Resolves the given module path from the given root `module_`. pub fn resolve_module_path_from_root(@mut self, module_: @mut Module, - module_path: &[ident], + module_path: &[Ident], index: uint, span: Span, mut name_search_type: NameSearchType) @@ -2729,7 +2729,7 @@ impl Resolver { /// rooted at the given module. pub fn resolve_module_path(@mut self, module_: @mut Module, - module_path: &[ident], + module_path: &[Ident], use_lexical_scope: UseLexicalScopeFlag, span: Span, name_search_type: NameSearchType) @@ -2822,7 +2822,7 @@ impl Resolver { /// import resolution. pub fn resolve_item_in_lexical_scope(@mut self, module_: @mut Module, - name: ident, + name: Ident, namespace: Namespace, search_through_modules: SearchThroughModulesFlag) @@ -2951,7 +2951,7 @@ impl Resolver { /// Resolves a module name in the current lexical scope. pub fn resolve_module_in_lexical_scope(@mut self, module_: @mut Module, - name: ident) + name: Ident) -> ResolveResult<@mut Module> { // If this module is an anonymous module, resolve the item in the // lexical scope. Otherwise, resolve the item from the crate root. @@ -3038,7 +3038,7 @@ impl Resolver { /// (b) some chain of `super::`. pub fn resolve_module_prefix(@mut self, module_: @mut Module, - module_path: &[ident]) + module_path: &[Ident]) -> ResolveResult { // Start at the current module if we see `self` or `super`, or at the // top of the crate otherwise. @@ -3081,7 +3081,7 @@ impl Resolver { /// the name. pub fn resolve_name_in_module(@mut self, module_: @mut Module, - name: ident, + name: Ident, namespace: Namespace, name_search_type: NameSearchType) -> ResolveResult { @@ -3273,7 +3273,7 @@ impl Resolver { pub fn add_exports_of_namebindings(@mut self, exports2: &mut ~[Export2], - ident: ident, + ident: Ident, namebindings: @mut NameBindings, ns: Namespace, reexport: bool) { @@ -3344,7 +3344,7 @@ impl Resolver { // generate a fake "implementation scope" containing all the // implementations thus found, for compatibility with old resolve pass. - pub fn with_scope(@mut self, name: Option, f: &fn()) { + pub fn with_scope(@mut self, name: Option, f: &fn()) { let orig_module = self.current_module; // Move down in the graph. @@ -3498,7 +3498,7 @@ impl Resolver { pub fn search_ribs(@mut self, ribs: &mut ~[@Rib], - name: ident, + name: Ident, span: Span, allow_capturing_self: AllowCapturingSelfFlag) -> Option { @@ -3892,7 +3892,7 @@ impl Resolver { generics: &Generics, fields: &[@struct_field], visitor: &mut ResolveVisitor) { - let mut ident_map: HashMap = HashMap::new(); + let mut ident_map: HashMap = HashMap::new(); for &field in fields.iter() { match field.node.kind { named_field(ident, _) => { @@ -4035,7 +4035,7 @@ impl Resolver { pub fn resolve_module(@mut self, module_: &_mod, _span: Span, - _name: ident, + _name: Ident, id: NodeId, visitor: &mut ResolveVisitor) { // Write the implementations in scope into the module metadata. @@ -4272,7 +4272,7 @@ impl Resolver { mutability: Mutability, // Maps idents to the node ID for the (outermost) // pattern that binds them - bindings_list: Option<@mut HashMap>, + bindings_list: Option<@mut HashMap>, visitor: &mut ResolveVisitor) { let pat_id = pattern.id; do walk_pat(pattern) |pattern| { @@ -4517,7 +4517,7 @@ impl Resolver { }; } - pub fn resolve_bare_identifier_pattern(@mut self, name: ident) + pub fn resolve_bare_identifier_pattern(@mut self, name: Ident) -> BareIdentifierPatternResolution { match self.resolve_item_in_lexical_scope(self.current_module, @@ -4604,7 +4604,7 @@ impl Resolver { } pub fn resolve_identifier(@mut self, - identifier: ident, + identifier: Ident, namespace: Namespace, check_ribs: bool, span: Span) @@ -4629,7 +4629,7 @@ impl Resolver { // FIXME #4952: Merge me with resolve_name_in_module? pub fn resolve_definition_of_name_in_module(@mut self, containing_module: @mut Module, - name: ident, + name: Ident, namespace: Namespace, xray: XrayFlag) -> NameDefinition { @@ -4702,7 +4702,7 @@ impl Resolver { return NoNameDefinition; } - pub fn intern_module_part_of_path(@mut self, path: &Path) -> ~[ident] { + pub fn intern_module_part_of_path(@mut self, path: &Path) -> ~[Ident] { let mut module_path_idents = ~[]; for (index, segment) in path.segments.iter().enumerate() { if index == path.segments.len() - 1 { @@ -4829,7 +4829,7 @@ impl Resolver { } pub fn resolve_identifier_in_local_ribs(@mut self, - ident: ident, + ident: Ident, namespace: Namespace, span: Span) -> Option { @@ -4895,7 +4895,7 @@ impl Resolver { } pub fn resolve_item_by_identifier_in_lexical_scope(@mut self, - ident: ident, + ident: Ident, namespace: Namespace) -> Option { // Check the items. @@ -5273,7 +5273,7 @@ impl Resolver { } } - pub fn search_for_traits_containing_method(@mut self, name: ident) + pub fn search_for_traits_containing_method(@mut self, name: Ident) -> ~[def_id] { debug!("(searching for traits containing method) looking for '%s'", self.session.str_of(name)); @@ -5376,7 +5376,7 @@ impl Resolver { pub fn add_trait_info(&self, found_traits: &mut ~[def_id], trait_def_id: def_id, - name: ident) { + name: Ident) { debug!("(adding trait info) found trait %d:%d for method '%s'", trait_def_id.crate, trait_def_id.node, @@ -5493,7 +5493,7 @@ impl Resolver { if idents.len() == 0 { return ~"???"; } - return self.idents_to_str(idents.move_rev_iter().collect::<~[ast::ident]>()); + return self.idents_to_str(idents.move_rev_iter().collect::<~[ast::Ident]>()); } pub fn dump_module(@mut self, module_: @mut Module) { diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 9259b323d429b..e42700fea76fd 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -222,7 +222,7 @@ use util::ppaux::{Repr, vec_map_to_str}; use std::hashmap::HashMap; use std::vec; use syntax::ast; -use syntax::ast::ident; +use syntax::ast::Ident; use syntax::ast_util::path_to_ident; use syntax::ast_util; use syntax::codemap::{Span, dummy_sp}; @@ -390,7 +390,7 @@ struct BindingInfo { ty: ty::t, } -type BindingsMap = HashMap; +type BindingsMap = HashMap; #[deriving(Clone)] struct ArmData<'self> { @@ -409,7 +409,7 @@ struct ArmData<'self> { struct Match<'self> { pats: ~[@ast::pat], data: ArmData<'self>, - bound_ptrs: ~[(ident, ValueRef)] + bound_ptrs: ~[(Ident, ValueRef)] } impl<'self> Repr for Match<'self> { @@ -736,7 +736,7 @@ fn enter_rec_or_struct<'r>(bcx: @mut Block, dm: DefMap, m: &[Match<'r>], col: uint, - fields: &[ast::ident], + fields: &[ast::Ident], val: ValueRef) -> ~[Match<'r>] { debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%s)", @@ -1076,8 +1076,8 @@ fn extract_vec_elems(bcx: @mut Block, fn collect_record_or_struct_fields(bcx: @mut Block, m: &[Match], col: uint) - -> Option<~[ast::ident]> { - let mut fields: ~[ast::ident] = ~[]; + -> Option<~[ast::Ident]> { + let mut fields: ~[ast::Ident] = ~[]; let mut found = false; for br in m.iter() { match br.pats[col].node { @@ -1099,7 +1099,7 @@ fn collect_record_or_struct_fields(bcx: @mut Block, return None; } - fn extend(idents: &mut ~[ast::ident], field_pats: &[ast::field_pat]) { + fn extend(idents: &mut ~[ast::Ident], field_pats: &[ast::field_pat]) { for field_pat in field_pats.iter() { let field_ident = field_pat.ident; if !idents.iter().any(|x| *x == field_ident) { diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 7206eb4755410..79440b03d761f 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -76,7 +76,7 @@ use std::vec; use std::local_data; use extra::time; use extra::sort; -use syntax::ast::ident; +use syntax::ast::Ident; use syntax::ast_map::{path, path_elt_to_str, path_name}; use syntax::ast_util::{local_def}; use syntax::attr; @@ -1203,7 +1203,7 @@ pub fn scope_block(bcx: @mut Block, pub fn loop_scope_block(bcx: @mut Block, loop_break: @mut Block, - loop_label: Option, + loop_label: Option, n: &str, opt_node_info: Option) -> @mut Block { return new_block(bcx.fcx, Some(bcx), Some(@mut ScopeInfo { diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 6a0541f0046b4..9b608d1266950 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -38,7 +38,7 @@ use std::cast; use std::hashmap::{HashMap}; use std::libc::{c_uint, c_longlong, c_ulonglong, c_char}; use std::vec; -use syntax::ast::ident; +use syntax::ast::Ident; use syntax::ast_map::{path, path_elt}; use syntax::codemap::Span; use syntax::parse::token; @@ -46,7 +46,7 @@ use syntax::{ast, ast_map}; pub use middle::trans::context::CrateContext; -pub fn gensym_name(name: &str) -> ident { +pub fn gensym_name(name: &str) -> Ident { token::str_to_ident(fmt!("%s_%u", name, token::gensym(name))) } @@ -460,7 +460,7 @@ pub fn block_cleanups(bcx: @mut Block) -> ~[cleanup] { pub struct ScopeInfo { parent: Option<@mut ScopeInfo>, loop_break: Option<@mut Block>, - loop_label: Option, + loop_label: Option, // A list of functions that must be run at when leaving this // block, cleaning up any variables that were introduced in the // block. @@ -562,7 +562,7 @@ impl Block { pub fn tcx(&self) -> ty::ctxt { self.fcx.ccx.tcx } pub fn sess(&self) -> Session { self.fcx.ccx.sess } - pub fn ident(&self, ident: ident) -> @str { + pub fn ident(&self, ident: Ident) -> @str { token::ident_to_str(&ident) } diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs index 9f99a0c92e534..02659b99afcf7 100644 --- a/src/librustc/middle/trans/context.rs +++ b/src/librustc/middle/trans/context.rs @@ -87,7 +87,7 @@ pub struct CrateContext { // Cache of external const values extern_const_values: HashMap, - impl_method_cache: HashMap<(ast::def_id, ast::ident), ast::def_id>, + impl_method_cache: HashMap<(ast::def_id, ast::Ident), ast::def_id>, module_data: HashMap<~str, ValueRef>, lltypes: HashMap, diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index feacede972545..be4fef3693478 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -27,7 +27,7 @@ use util::ppaux; use middle::trans::type_::Type; use syntax::ast; -use syntax::ast::ident; +use syntax::ast::Ident; use syntax::ast_map::path_mod; use syntax::ast_util; use syntax::codemap::Span; @@ -194,7 +194,7 @@ pub fn trans_while(bcx: @mut Block, cond: @ast::expr, body: &ast::Block) -> @mut pub fn trans_loop(bcx:@mut Block, body: &ast::Block, - opt_label: Option) + opt_label: Option) -> @mut Block { let _icx = push_ctxt("trans_loop"); let next_bcx = sub_block(bcx, "next"); @@ -273,7 +273,7 @@ pub fn trans_log(log_ex: &ast::expr, } pub fn trans_break_cont(bcx: @mut Block, - opt_label: Option, + opt_label: Option, to_end: bool) -> @mut Block { let _icx = push_ctxt("trans_break_cont"); @@ -326,11 +326,11 @@ pub fn trans_break_cont(bcx: @mut Block, return bcx; } -pub fn trans_break(bcx: @mut Block, label_opt: Option) -> @mut Block { +pub fn trans_break(bcx: @mut Block, label_opt: Option) -> @mut Block { return trans_break_cont(bcx, label_opt, true); } -pub fn trans_cont(bcx: @mut Block, label_opt: Option) -> @mut Block { +pub fn trans_cont(bcx: @mut Block, label_opt: Option) -> @mut Block { return trans_break_cont(bcx, label_opt, false); } diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 71269d5e61e28..b69b9b308ba44 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -155,7 +155,7 @@ pub fn create_local_var_metadata(bcx: @mut Block, local: &ast::Local) { /// /// Adds the created metadata nodes directly to the crate's IR. pub fn create_match_binding_metadata(bcx: @mut Block, - variable_ident: ast::ident, + variable_ident: ast::Ident, node_id: ast::NodeId, variable_type: ty::t, span: Span) { @@ -640,7 +640,7 @@ fn compile_unit_metadata(cx: @mut CrateContext) { } fn declare_local(bcx: @mut Block, - variable_ident: ast::ident, + variable_ident: ast::Ident, node_id: ast::NodeId, variable_type: ty::t, span: Span) { @@ -1539,7 +1539,7 @@ fn populate_scope_map(cx: &mut CrateContext, struct ScopeStackEntry { scope_metadata: DIScope, - ident: Option + ident: Option } let mut scope_stack = ~[ScopeStackEntry { scope_metadata: fn_metadata, ident: None }]; diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index f36b20e053bf1..1aedf1ab62358 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -894,7 +894,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::expr) -> DatumBlock { fn trans_rec_field(bcx: @mut Block, base: @ast::expr, - field: ast::ident) -> DatumBlock { + field: ast::Ident) -> DatumBlock { //! Translates `base.field`. let mut bcx = bcx; diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index fb4dd8a74fb61..fa10b8a8e4493 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -47,7 +47,7 @@ see `trans::base::lval_static_fn()` or `trans::base::monomorphic_fn()`. */ pub fn trans_impl(ccx: @mut CrateContext, path: path, - name: ast::ident, + name: ast::Ident, methods: &[@ast::method], generics: &ast::Generics, id: ast::NodeId) { @@ -294,7 +294,7 @@ pub fn trans_static_method_callee(bcx: @mut Block, pub fn method_with_name(ccx: &mut CrateContext, impl_id: ast::def_id, - name: ast::ident) -> ast::def_id { + name: ast::Ident) -> ast::def_id { let meth_id_opt = ccx.impl_method_cache.find_copy(&(impl_id, name)); match meth_id_opt { Some(m) => return m, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index b464ce6d624e8..c548b18f72c89 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -56,7 +56,7 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0; #[deriving(Eq, IterBytes)] pub struct field { - ident: ast::ident, + ident: ast::Ident, mt: mt } @@ -68,7 +68,7 @@ pub enum MethodContainer { #[deriving(Clone)] pub struct Method { - ident: ast::ident, + ident: ast::Ident, generics: ty::Generics, transformed_self_ty: Option, fty: BareFnTy, @@ -82,7 +82,7 @@ pub struct Method { } impl Method { - pub fn new(ident: ast::ident, + pub fn new(ident: ast::Ident, generics: ty::Generics, transformed_self_ty: Option, fty: BareFnTy, @@ -122,7 +122,7 @@ impl Method { pub struct Impl { did: def_id, - ident: ident, + ident: Ident, methods: ~[@Method] } @@ -156,7 +156,7 @@ pub enum SelfMode { } pub struct field_ty { - ident: ident, + ident: Ident, id: def_id, vis: ast::visibility, } @@ -431,7 +431,7 @@ pub struct ClosureTy { * - `output` is the return type. */ #[deriving(Clone, Eq, IterBytes)] pub struct FnSig { - bound_lifetime_names: OptVec, + bound_lifetime_names: OptVec, inputs: ~[t], output: t } @@ -504,7 +504,7 @@ pub enum bound_region { br_anon(uint), /// Named region parameters for functions (a in &'a T) - br_named(ast::ident), + br_named(ast::Ident), /// Fresh bound identifiers created during GLB computations. br_fresh(uint), @@ -684,7 +684,7 @@ pub enum type_err { terr_ty_param_size(expected_found), terr_record_size(expected_found), terr_record_mutability, - terr_record_fields(expected_found), + terr_record_fields(expected_found), terr_arg_count, terr_regions_does_not_outlive(Region, Region), terr_regions_not_same(Region, Region), @@ -693,7 +693,7 @@ pub enum type_err { terr_regions_overly_polymorphic(bound_region, Region), terr_vstores_differ(terr_vstore_kind, expected_found), terr_trait_stores_differ(terr_vstore_kind, expected_found), - terr_in_field(@type_err, ast::ident), + terr_in_field(@type_err, ast::Ident), terr_sorts(expected_found), terr_integer_as_char, terr_int_mismatch(expected_found), @@ -848,7 +848,7 @@ impl ToStr for IntVarValue { #[deriving(Clone)] pub struct TypeParameterDef { - ident: ast::ident, + ident: ast::Ident, def_id: ast::def_id, bounds: @ParamBounds } @@ -3359,13 +3359,13 @@ pub fn stmt_node_id(s: &ast::stmt) -> ast::NodeId { } } -pub fn field_idx(id: ast::ident, fields: &[field]) -> Option { +pub fn field_idx(id: ast::Ident, fields: &[field]) -> Option { let mut i = 0u; for f in fields.iter() { if f.ident == id { return Some(i); } i += 1u; } return None; } -pub fn field_idx_strict(tcx: ty::ctxt, id: ast::ident, fields: &[field]) +pub fn field_idx_strict(tcx: ty::ctxt, id: ast::Ident, fields: &[field]) -> uint { let mut i = 0u; for f in fields.iter() { if f.ident == id { return i; } i += 1u; } @@ -3375,7 +3375,7 @@ pub fn field_idx_strict(tcx: ty::ctxt, id: ast::ident, fields: &[field]) fields.map(|f| tcx.sess.str_of(f.ident)))); } -pub fn method_idx(id: ast::ident, meths: &[@Method]) -> Option { +pub fn method_idx(id: ast::Ident, meths: &[@Method]) -> Option { meths.iter().position(|m| m.ident == id) } @@ -3823,9 +3823,9 @@ fn struct_ctor_id(cx: ctxt, struct_did: ast::def_id) -> Option { #[deriving(Clone)] pub struct VariantInfo { args: ~[t], - arg_names: Option<~[ast::ident]>, + arg_names: Option<~[ast::Ident]>, ctor_ty: t, - name: ast::ident, + name: ast::Ident, id: ast::def_id, disr_val: Disr, vis: visibility diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 419bc999e033a..8ba6234e6095a 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -555,7 +555,7 @@ pub fn ty_of_arg( this: &AC, - ast_lifetimes: &OptVec) -> OptVec + ast_lifetimes: &OptVec) -> OptVec { /*! * diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index c20ccafe82c4e..c45f1c6ac4a10 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -126,7 +126,7 @@ pub fn lookup( self_expr: @ast::expr, // The expression `a`. callee_id: NodeId, /* Where to store `a.b`'s type, * also the scope of the call */ - m_name: ast::ident, // The ident `b`. + m_name: ast::Ident, // The ident `b`. self_ty: ty::t, // The type of `a`. supplied_tps: &[ty::t], // The list of types X, Y, ... . deref_args: check::DerefArgs, // Whether we autopointer first. @@ -173,7 +173,7 @@ pub struct LookupContext<'self> { expr: @ast::expr, self_expr: @ast::expr, callee_id: NodeId, - m_name: ast::ident, + m_name: ast::Ident, supplied_tps: &'self [ty::t], impl_dups: @mut HashSet, inherent_candidates: @mut ~[Candidate], diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 0d4185470b7dc..8d5f257ebd6bf 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -557,7 +557,7 @@ pub fn check_method(ccx: @mut CrateCtxt, } pub fn check_no_duplicate_fields(tcx: ty::ctxt, - fields: ~[(ast::ident, Span)]) { + fields: ~[(ast::Ident, Span)]) { let mut field_names = HashMap::new(); for p in fields.iter() { @@ -714,7 +714,7 @@ impl RegionScope for FnCtxt { } fn named_region(&self, span: Span, - id: ast::ident) -> Result { + id: ast::Ident) -> Result { self.search_in_scope_regions(span, ty::br_named(id)) } } @@ -1116,7 +1116,7 @@ pub fn impl_self_ty(vcx: &VtableContext, pub fn lookup_field_ty(tcx: ty::ctxt, class_id: ast::def_id, items: &[ty::field_ty], - fieldname: ast::ident, + fieldname: ast::Ident, substs: &ty::substs) -> Option { let o_field = items.iter().find(|f| f.ident == fieldname); @@ -1536,7 +1536,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, callee_id: ast::NodeId, expr: @ast::expr, rcvr: @ast::expr, - method_name: ast::ident, + method_name: ast::Ident, args: &[@ast::expr], tps: &[ast::Ty], sugar: ast::CallSugar) { @@ -1636,7 +1636,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, op_ex: @ast::expr, self_ex: @ast::expr, self_t: ty::t, - opname: ast::ident, + opname: ast::Ident, args: ~[@ast::expr], deref_args: DerefArgs, autoderef_receiver: AutoderefReceiverFlag, @@ -1936,7 +1936,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fn check_field(fcx: @mut FnCtxt, expr: @ast::expr, base: @ast::expr, - field: ast::ident, + field: ast::Ident, tys: &[ast::Ty]) { let tcx = fcx.ccx.tcx; let bot = check_expr(fcx, base); diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 4707af5ca6c8c..f882a25ba8086 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -368,7 +368,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, trait_rp: Option, trait_generics: &ast::Generics, m_id: &ast::NodeId, - m_ident: &ast::ident, + m_ident: &ast::Ident, m_explicit_self: &ast::explicit_self, m_generics: &ast::Generics, m_purity: &ast::purity, diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index b1342de067cd4..d3dc3d1fb1c9a 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -27,7 +27,7 @@ pub struct RegionError { pub trait RegionScope { fn anon_region(&self, span: Span) -> Result; fn self_region(&self, span: Span) -> Result; - fn named_region(&self, span: Span, id: ast::ident) + fn named_region(&self, span: Span, id: ast::Ident) -> Result; } @@ -43,7 +43,7 @@ impl RegionScope for EmptyRscope { fn self_region(&self, _span: Span) -> Result { self.anon_region(_span) } - fn named_region(&self, _span: Span, _id: ast::ident) + fn named_region(&self, _span: Span, _id: ast::Ident) -> Result { self.anon_region(_span) @@ -51,14 +51,14 @@ impl RegionScope for EmptyRscope { } #[deriving(Clone)] -pub struct RegionParamNames(OptVec); +pub struct RegionParamNames(OptVec); impl RegionParamNames { fn has_self(&self) -> bool { self.has_ident(special_idents::self_) } - fn has_ident(&self, ident: ast::ident) -> bool { + fn has_ident(&self, ident: ast::Ident) -> bool { for region_param_name in self.iter() { if *region_param_name == ident { return true; @@ -197,7 +197,7 @@ impl RegionScope for MethodRscope { } result::Ok(ty::re_bound(ty::br_self)) } - fn named_region(&self, span: Span, id: ast::ident) + fn named_region(&self, span: Span, id: ast::Ident) -> Result { if !self.region_param_names.has_ident(id) { return RegionParamNames::undeclared_name(None); @@ -249,7 +249,7 @@ impl RegionScope for TypeRscope { } result::Ok(ty::re_bound(ty::br_self)) } - fn named_region(&self, span: Span, id: ast::ident) + fn named_region(&self, span: Span, id: ast::Ident) -> Result { do EmptyRscope.named_region(span, id).chain_err |_e| { result::Err(RegionError { @@ -308,7 +308,7 @@ impl RegionScope for BindingRscope { } fn named_region(&self, span: Span, - id: ast::ident) -> Result + id: ast::Ident) -> Result { do self.base.named_region(span, id).chain_err |_e| { let result = ty::re_bound(ty::br_named(id)); diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index de839239e7282..fe33205171430 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -305,7 +305,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { fn bare_fn_to_str(cx: ctxt, purity: ast::purity, abis: AbiSet, - ident: Option, + ident: Option, sig: &ty::FnSig) -> ~str { let mut s = ~"extern "; @@ -693,7 +693,7 @@ impl Repr for ty::Method { } } -impl Repr for ast::ident { +impl Repr for ast::Ident { fn repr(&self, _tcx: ctxt) -> ~str { token::ident_to_str(self).to_owned() } diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs index 55552924d4461..88a63a9cb59da 100644 --- a/src/librustdoc/extract.rs +++ b/src/librustdoc/extract.rs @@ -22,7 +22,7 @@ use syntax::parse::token; // Hack; rather than thread an interner through everywhere, rely on // thread-local data // Hack-Becomes-Feature: using thread-local-state everywhere... -pub fn to_str(id: ast::ident) -> ~str { +pub fn to_str(id: ast::Ident) -> ~str { /* bad */ ident_to_str(&id).to_owned() } diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 98c499900a20c..1b06f78abb911 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -54,14 +54,14 @@ pub fn is_cmd(cmd: &str) -> bool { struct ListenerFn { cmds: ~[~str], span: codemap::Span, - path: ~[ast::ident] + path: ~[ast::Ident] } struct ReadyCtx { sess: session::Session, crate: @ast::Crate, ext_cx: @ExtCtxt, - path: ~[ast::ident], + path: ~[ast::Ident], fns: ~[ListenerFn] } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index a7fad7def186f..d7a05667a9883 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -25,10 +25,12 @@ use extra::serialize::{Encodable, Decodable, Encoder, Decoder}; // macro expansion per Flatt et al., "Macros // That Work Together" #[deriving(Clone, Eq, IterBytes, ToStr)] -pub struct ident { name: Name, ctxt: SyntaxContext } +pub struct Ident { name: Name, ctxt: SyntaxContext } -/// Construct an identifier with the given name and an empty context: -pub fn new_ident(name: Name) -> ident { ident {name: name, ctxt: empty_ctxt}} +impl Ident { + /// Construct an identifier with the given name and an empty context: + pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: empty_ctxt}} +} /// A SyntaxContext represents a chain of macro-expandings /// and renamings. Each macro expansion corresponds to @@ -48,7 +50,7 @@ pub type SyntaxContext = uint; pub struct SCTable { table : ~[SyntaxContext_], mark_memo : HashMap<(SyntaxContext,Mrk),SyntaxContext>, - rename_memo : HashMap<(SyntaxContext,ident,Name),SyntaxContext> + rename_memo : HashMap<(SyntaxContext,Ident,Name),SyntaxContext> } // NB: these must be placed in any SCTable... pub static empty_ctxt : uint = 0; @@ -66,7 +68,7 @@ pub enum SyntaxContext_ { // "to" slot must have the same name and context // in the "from" slot. In essence, they're all // pointers to a single "rename" event node. - Rename (ident,Name,SyntaxContext), + Rename (Ident,Name,SyntaxContext), IllegalCtxt() } @@ -76,27 +78,27 @@ pub type Name = uint; /// A mark represents a unique id associated with a macro expansion pub type Mrk = uint; -impl Encodable for ident { +impl Encodable for Ident { fn encode(&self, s: &mut S) { s.emit_str(interner_get(self.name)); } } #[deriving(IterBytes)] -impl Decodable for ident { - fn decode(d: &mut D) -> ident { +impl Decodable for Ident { + fn decode(d: &mut D) -> Ident { str_to_ident(d.read_str()) } } /// Function name (not all functions have names) -pub type fn_ident = Option; +pub type fn_ident = Option; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct Lifetime { id: NodeId, span: Span, - ident: ident + ident: Ident } // a "Path" is essentially Rust's notion of a name; @@ -118,7 +120,7 @@ pub struct Path { #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct PathSegment { /// The identifier portion of this path segment. - identifier: ident, + identifier: Ident, /// The lifetime parameter for this path segment. Currently only one /// lifetime parameter is allowed. lifetime: Option, @@ -151,7 +153,7 @@ pub enum TyParamBound { #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct TyParam { - ident: ident, + ident: Ident, id: NodeId, bounds: OptVec } @@ -275,7 +277,7 @@ pub struct pat { #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct field_pat { - ident: ident, + ident: Ident, pat: @pat, } @@ -430,7 +432,7 @@ pub struct arm { #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct Field { - ident: ident, + ident: Ident, expr: @expr, span: Span, } @@ -473,7 +475,7 @@ pub enum expr_ { expr_vstore(@expr, expr_vstore), expr_vec(~[@expr], mutability), expr_call(@expr, ~[@expr], CallSugar), - expr_method_call(NodeId, @expr, ident, ~[Ty], ~[@expr], CallSugar), + expr_method_call(NodeId, @expr, Ident, ~[Ty], ~[@expr], CallSugar), expr_tup(~[@expr]), expr_binary(NodeId, binop, @expr, @expr), expr_unary(NodeId, unop, @expr), @@ -485,7 +487,7 @@ pub enum expr_ { /* Conditionless loop (can be exited with break, cont, or ret) Same semantics as while(true) { body }, but typestate knows that the (implicit) condition is always true. */ - expr_loop(Block, Option), + expr_loop(Block, Option), expr_match(@expr, ~[arm]), expr_fn_block(fn_decl, Block), expr_do_body(@expr), @@ -493,15 +495,15 @@ pub enum expr_ { expr_assign(@expr, @expr), expr_assign_op(NodeId, binop, @expr, @expr), - expr_field(@expr, ident, ~[Ty]), + expr_field(@expr, Ident, ~[Ty]), expr_index(NodeId, @expr, @expr), expr_path(Path), /// The special identifier `self`. expr_self, expr_addr_of(mutability, @expr), - expr_break(Option), - expr_again(Option), + expr_break(Option), + expr_again(Option), expr_ret(Option<@expr>), expr_log(@expr, @expr), @@ -550,7 +552,7 @@ pub enum token_tree { tt_seq(Span, @mut ~[token_tree], Option<::parse::token::Token>, bool), // a syntactic variable that will be filled in by macro expansion. - tt_nonterminal(Span, ident) + tt_nonterminal(Span, Ident) } // @@ -615,7 +617,7 @@ pub enum matcher_ { // lo, hi position-in-match-array used: match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint), // parse a Rust NT: name to bind, name of NT, position in match array: - match_nonterminal(ident, ident, uint) + match_nonterminal(Ident, Ident, uint) } pub type mac = Spanned; @@ -649,14 +651,14 @@ pub struct mt { #[deriving(Eq, Encodable, Decodable,IterBytes)] pub struct TypeField { - ident: ident, + ident: Ident, mt: mt, span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct TypeMethod { - ident: ident, + ident: Ident, attrs: ~[Attribute], purity: purity, decl: fn_decl, @@ -868,7 +870,7 @@ pub type explicit_self = Spanned; #[deriving(Eq, Encodable, Decodable,IterBytes)] pub struct method { - ident: ident, + ident: Ident, attrs: ~[Attribute], generics: Generics, explicit_self: explicit_self, @@ -921,7 +923,7 @@ pub struct enum_def { #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct variant_ { - name: ident, + name: Ident, attrs: ~[Attribute], kind: variant_kind, id: NodeId, @@ -933,7 +935,7 @@ pub type variant = Spanned; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct path_list_ident_ { - name: ident, + name: Ident, id: NodeId, } @@ -949,7 +951,7 @@ pub enum view_path_ { // or just // // foo::bar::baz (with 'baz =' implicitly on the left) - view_path_simple(ident, Path, NodeId), + view_path_simple(Ident, Path, NodeId), // foo::bar::* view_path_glob(Path, NodeId), @@ -972,7 +974,7 @@ pub enum view_item_ { // optional @str: if present, this is a location (containing // arbitrary characters) from which to fetch the crate sources // For example, extern mod whatever = "github.com/mozilla/rust" - view_item_extern_mod(ident, Option<@str>, ~[@MetaItem], NodeId), + view_item_extern_mod(Ident, Option<@str>, ~[@MetaItem], NodeId), view_item_use(~[@view_path]), } @@ -1037,7 +1039,7 @@ pub type struct_field = Spanned; #[deriving(Eq, Encodable, Decodable,IterBytes)] pub enum struct_field_kind { - named_field(ident, visibility), + named_field(Ident, visibility), unnamed_field // element of a tuple-like struct } @@ -1055,7 +1057,7 @@ pub struct struct_def { */ #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct item { - ident: ident, + ident: Ident, attrs: ~[Attribute], id: NodeId, node: item_, @@ -1083,7 +1085,7 @@ pub enum item_ { #[deriving(Eq, Encodable, Decodable,IterBytes)] pub struct foreign_item { - ident: ident, + ident: Ident, attrs: ~[Attribute], node: foreign_item_, id: NodeId, diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index c900bf2c15d0c..6e022e9804b41 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -27,8 +27,8 @@ use std::vec; #[deriving(Clone, Eq)] pub enum path_elt { - path_mod(ident), - path_name(ident) + path_mod(Ident), + path_name(Ident) } pub type path = ~[path_elt]; @@ -44,7 +44,7 @@ pub fn path_to_str_with_sep(p: &[path_elt], sep: &str, itr: @ident_interner) strs.connect(sep) } -pub fn path_ident_to_str(p: &path, i: ident, itr: @ident_interner) -> ~str { +pub fn path_ident_to_str(p: &path, i: Ident, itr: @ident_interner) -> ~str { if p.is_empty() { itr.get(i.name).to_owned() } else { @@ -74,7 +74,7 @@ pub enum ast_node { node_expr(@expr), node_stmt(@stmt), node_arg, - node_local(ident), + node_local(Ident), node_block(Block), node_struct_ctor(@struct_def, @item, @path), node_callee_scope(@expr) @@ -89,7 +89,7 @@ pub struct Ctx { } impl Ctx { - fn extend(&self, elt: ident) -> @path { + fn extend(&self, elt: Ident) -> @path { @vec::append(self.path.clone(), [path_name(elt)]) } @@ -110,7 +110,7 @@ impl Ctx { fn map_struct_def(&mut self, struct_def: @ast::struct_def, parent_node: ast_node, - ident: ast::ident) { + ident: ast::Ident) { let p = self.extend(ident); // If this is a tuple-like struct, register the constructor. @@ -356,7 +356,7 @@ impl Visitor<()> for Ctx { fn visit_struct_def(&mut self, struct_def: @struct_def, - ident: ident, + ident: Ident, generics: &Generics, node_id: NodeId, _: ()) { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 62c2e9af938fd..810ce9940f2e1 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -23,12 +23,12 @@ use std::local_data; use std::num; use std::option; -pub fn path_name_i(idents: &[ident]) -> ~str { +pub fn path_name_i(idents: &[Ident]) -> ~str { // FIXME: Bad copies (#2543 -- same for everything else that says "bad") idents.map(|i| token::interner_get(i.name)).connect("::") } -pub fn path_to_ident(path: &Path) -> ident { +pub fn path_to_ident(path: &Path) -> Ident { path.segments.last().identifier } @@ -217,7 +217,7 @@ pub fn default_block( } } -pub fn ident_to_path(s: Span, identifier: ident) -> Path { +pub fn ident_to_path(s: Span, identifier: Ident) -> Path { ast::Path { span: s, global: false, @@ -231,7 +231,7 @@ pub fn ident_to_path(s: Span, identifier: ident) -> Path { } } -pub fn ident_to_pat(id: NodeId, s: Span, i: ident) -> @pat { +pub fn ident_to_pat(id: NodeId, s: Span, i: Ident) -> @pat { @ast::pat { id: id, node: pat_ident(bind_infer, ident_to_path(s, i), None), span: s } @@ -302,13 +302,13 @@ pub fn struct_field_visibility(field: ast::struct_field) -> visibility { } pub trait inlined_item_utils { - fn ident(&self) -> ident; + fn ident(&self) -> Ident; fn id(&self) -> ast::NodeId; fn accept>(&self, e: E, v: &mut V); } impl inlined_item_utils for inlined_item { - fn ident(&self) -> ident { + fn ident(&self) -> Ident { match *self { ii_item(i) => i.ident, ii_foreign(i) => i.ident, @@ -608,7 +608,7 @@ impl Visitor<()> for IdVisitor { // XXX: Default fn visit_struct_def(&mut self, struct_definition: @struct_def, - identifier: ident, + identifier: Ident, generics: &Generics, node_id: NodeId, env: ()) { @@ -749,7 +749,7 @@ impl SimpleVisitor for EachViewItemData { } fn visit_struct_def(&mut self, _: @struct_def, - _: ident, + _: Ident, _: &Generics, _: NodeId) { // XXX: Default method. @@ -827,7 +827,7 @@ pub fn pat_is_ident(pat: @ast::pat) -> bool { // HYGIENE FUNCTIONS /// Construct an identifier with the given name and an empty context: -pub fn new_ident(name: Name) -> ident { ident {name: name, ctxt: 0}} +pub fn new_ident(name: Name) -> Ident { Ident {name: name, ctxt: 0}} /// Extend a syntax context with a given mark pub fn new_mark(m:Mrk, tail:SyntaxContext) -> SyntaxContext { @@ -859,13 +859,13 @@ pub fn new_mark_internal(m:Mrk, tail:SyntaxContext,table:&mut SCTable) } /// Extend a syntax context with a given rename -pub fn new_rename(id:ident, to:Name, tail:SyntaxContext) -> SyntaxContext { +pub fn new_rename(id:Ident, to:Name, tail:SyntaxContext) -> SyntaxContext { new_rename_internal(id, to, tail, get_sctable()) } // Extend a syntax context with a given rename and sctable // FIXME #4536 : currently pub to allow testing -pub fn new_rename_internal(id:ident, to:Name, tail:SyntaxContext, table: &mut SCTable) +pub fn new_rename_internal(id:Ident, to:Name, tail:SyntaxContext, table: &mut SCTable) -> SyntaxContext { let key = (tail,id,to); // FIXME #5074 @@ -916,22 +916,22 @@ fn idx_push(vec: &mut ~[T], val: T) -> uint { } /// Resolve a syntax object to a name, per MTWT. -pub fn resolve(id : ident) -> Name { +pub fn resolve(id : Ident) -> Name { resolve_internal(id, get_sctable()) } // Resolve a syntax object to a name, per MTWT. // FIXME #4536 : currently pub to allow testing -pub fn resolve_internal(id : ident, table : &mut SCTable) -> Name { +pub fn resolve_internal(id : Ident, table : &mut SCTable) -> Name { match table.table[id.ctxt] { EmptyCtxt => id.name, // ignore marks here: - Mark(_,subctxt) => resolve_internal(ident{name:id.name, ctxt: subctxt},table), + Mark(_,subctxt) => resolve_internal(Ident{name:id.name, ctxt: subctxt},table), // do the rename if necessary: - Rename(ident{name,ctxt},toname,subctxt) => { + Rename(Ident{name,ctxt},toname,subctxt) => { // this could be cached or computed eagerly: - let resolvedfrom = resolve_internal(ident{name:name,ctxt:ctxt},table); - let resolvedthis = resolve_internal(ident{name:id.name,ctxt:subctxt},table); + let resolvedfrom = resolve_internal(Ident{name:name,ctxt:ctxt},table); + let resolvedthis = resolve_internal(Ident{name:id.name,ctxt:subctxt},table); if ((resolvedthis == resolvedfrom) && (marksof(ctxt,resolvedthis,table) == marksof(subctxt,resolvedthis,table))) { @@ -1014,12 +1014,12 @@ mod test { // convert a list of uints to an @[ident] // (ignores the interner completely) - fn uints_to_idents (uints: &~[uint]) -> @~[ident] { - @uints.map(|u| ident {name:*u, ctxt: empty_ctxt}) + fn uints_to_idents (uints: &~[uint]) -> @~[Ident] { + @uints.map(|u| Ident {name:*u, ctxt: empty_ctxt}) } - fn id (u : uint, s: SyntaxContext) -> ident { - ident{name:u, ctxt: s} + fn id (u : uint, s: SyntaxContext) -> Ident { + Ident{name:u, ctxt: s} } // because of the SCTable, I now need a tidy way of @@ -1027,7 +1027,7 @@ mod test { #[deriving(Clone, Eq)] enum TestSC { M(Mrk), - R(ident,Name) + R(Ident,Name) } // unfold a vector of TestSC values into a SCTable, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 83a19bb4634e2..913b68da0cb47 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -57,7 +57,7 @@ pub struct SyntaxExpanderTTItem { pub type SyntaxExpanderTTItemFun = @fn(@ExtCtxt, Span, - ast::ident, + ast::Ident, ~[ast::token_tree]) -> MacResult; @@ -114,7 +114,7 @@ pub struct BlockInfo { } // a list of ident->name renamings -type RenameList = ~[(ast::ident,Name)]; +type RenameList = ~[(ast::Ident,Name)]; // The base map of methods for expanding syntax extension // AST nodes into full ASTs @@ -228,7 +228,7 @@ pub struct ExtCtxt { // and there are bugs in the code for object // types that make this hard to get right at the // moment. - nmatsakis - mod_path: @mut ~[ast::ident], + mod_path: @mut ~[ast::Ident], trace_mac: @mut bool } @@ -255,9 +255,9 @@ impl ExtCtxt { } pub fn print_backtrace(&self) { } pub fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace } - pub fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); } + pub fn mod_push(&self, i: ast::Ident) { self.mod_path.push(i); } pub fn mod_pop(&self) { self.mod_path.pop(); } - pub fn mod_path(&self) -> ~[ast::ident] { (*self.mod_path).clone() } + pub fn mod_path(&self) -> ~[ast::Ident] { (*self.mod_path).clone() } pub fn bt_push(&self, ei: codemap::ExpnInfo) { match ei { ExpnInfo {call_site: cs, callee: ref callee} => { @@ -311,10 +311,10 @@ impl ExtCtxt { pub fn set_trace_macros(&self, x: bool) { *self.trace_mac = x } - pub fn str_of(&self, id: ast::ident) -> @str { + pub fn str_of(&self, id: ast::Ident) -> @str { ident_to_str(&id) } - pub fn ident_of(&self, st: &str) -> ast::ident { + pub fn ident_of(&self, st: &str) -> ast::Ident { str_to_ident(st) } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 194b4ab83f92e..55f7a35e1df52 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -9,7 +9,7 @@ // except according to those terms. use abi::AbiSet; -use ast::ident; +use ast::Ident; use ast; use ast_util; use codemap::{Span, respan, dummy_sp}; @@ -20,7 +20,7 @@ use opt_vec; use opt_vec::OptVec; pub struct Field { - ident: ast::ident, + ident: ast::Ident, ex: @ast::expr } @@ -32,12 +32,12 @@ mod syntax { pub trait AstBuilder { // paths - fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path; - fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path; - fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path; + fn path(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path; + fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path; + fn path_global(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path; fn path_all(&self, sp: Span, global: bool, - idents: ~[ast::ident], + idents: ~[ast::Ident], rp: Option, types: ~[ast::Ty]) -> ast::Path; @@ -47,7 +47,7 @@ pub trait AstBuilder { fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty; fn ty_path(&self, ast::Path, Option>) -> ast::Ty; - fn ty_ident(&self, span: Span, idents: ast::ident) -> ast::Ty; + fn ty_ident(&self, span: Span, idents: ast::Ident) -> ast::Ty; fn ty_rptr(&self, span: Span, ty: ast::Ty, @@ -62,22 +62,22 @@ pub trait AstBuilder { fn ty_vars(&self, ty_params: &OptVec) -> ~[ast::Ty]; fn ty_vars_global(&self, ty_params: &OptVec) -> ~[ast::Ty]; - fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField; + fn ty_field_imm(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::TypeField; fn strip_bounds(&self, bounds: &Generics) -> Generics; - fn typaram(&self, id: ast::ident, bounds: OptVec) -> ast::TyParam; + fn typaram(&self, id: ast::Ident, bounds: OptVec) -> ast::TyParam; fn trait_ref(&self, path: ast::Path) -> ast::trait_ref; fn typarambound(&self, path: ast::Path) -> ast::TyParamBound; - fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime; + fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime; // statements fn stmt_expr(&self, expr: @ast::expr) -> @ast::stmt; - fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt; + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::expr) -> @ast::stmt; fn stmt_let_typed(&self, sp: Span, mutbl: bool, - ident: ast::ident, + ident: ast::Ident, typ: ast::Ty, ex: @ast::expr) -> @ast::stmt; @@ -93,7 +93,7 @@ pub trait AstBuilder { // expressions fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr; fn expr_path(&self, path: ast::Path) -> @ast::expr; - fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr; + fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::expr; fn expr_self(&self, span: Span) -> @ast::expr; fn expr_binary(&self, sp: Span, op: ast::binop, @@ -104,19 +104,19 @@ pub trait AstBuilder { fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr; fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr; fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr; - fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr; + fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr; fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr; - fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr; - fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident], + fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::expr]) -> @ast::expr; + fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident], args: ~[@ast::expr]) -> @ast::expr; fn expr_method_call(&self, span: Span, - expr: @ast::expr, ident: ast::ident, + expr: @ast::expr, ident: ast::Ident, args: ~[@ast::expr]) -> @ast::expr; fn expr_block(&self, b: ast::Block) -> @ast::expr; - fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field; + fn field_imm(&self, span: Span, name: Ident, e: @ast::expr) -> ast::Field; fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr; - fn expr_struct_ident(&self, span: Span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr; + fn expr_struct_ident(&self, span: Span, id: ast::Ident, fields: ~[ast::Field]) -> @ast::expr; fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr; @@ -137,11 +137,11 @@ pub trait AstBuilder { fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat; fn pat_wild(&self, span: Span) -> @ast::pat; fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat; - fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat; + fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::pat; fn pat_ident_binding_mode(&self, span: Span, - ident: ast::ident, + ident: ast::Ident, bm: ast::binding_mode) -> @ast::pat; fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat; fn pat_struct(&self, span: Span, @@ -156,65 +156,65 @@ pub trait AstBuilder { fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr; - fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr; + fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::expr; fn lambda0(&self, span: Span, blk: ast::Block) -> @ast::expr; - fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr; + fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr; - fn lambda_expr(&self, span: Span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr; + fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], blk: @ast::expr) -> @ast::expr; fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr; - fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr; + fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr; - fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], blk: ~[@ast::stmt]) -> @ast::expr; + fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], blk: ~[@ast::stmt]) -> @ast::expr; fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr; - fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr; + fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::Ident) -> @ast::expr; // items fn item(&self, span: Span, - name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item; + name: Ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item; - fn arg(&self, span: Span, name: ident, ty: ast::Ty) -> ast::arg; + fn arg(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::arg; // XXX unused self fn fn_decl(&self, inputs: ~[ast::arg], output: ast::Ty) -> ast::fn_decl; fn item_fn_poly(&self, span: Span, - name: ident, + name: Ident, inputs: ~[ast::arg], output: ast::Ty, generics: Generics, body: ast::Block) -> @ast::item; fn item_fn(&self, span: Span, - name: ident, + name: Ident, inputs: ~[ast::arg], output: ast::Ty, body: ast::Block) -> @ast::item; - fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant; + fn variant(&self, span: Span, name: Ident, tys: ~[ast::Ty]) -> ast::variant; fn item_enum_poly(&self, span: Span, - name: ident, + name: Ident, enum_definition: ast::enum_def, generics: Generics) -> @ast::item; - fn item_enum(&self, span: Span, name: ident, enum_def: ast::enum_def) -> @ast::item; + fn item_enum(&self, span: Span, name: Ident, enum_def: ast::enum_def) -> @ast::item; fn item_struct_poly(&self, span: Span, - name: ident, + name: Ident, struct_def: ast::struct_def, generics: Generics) -> @ast::item; - fn item_struct(&self, span: Span, name: ident, struct_def: ast::struct_def) -> @ast::item; + fn item_struct(&self, span: Span, name: Ident, struct_def: ast::struct_def) -> @ast::item; fn item_mod(&self, span: Span, - name: ident, attrs: ~[ast::Attribute], + name: Ident, attrs: ~[ast::Attribute], vi: ~[ast::view_item], items: ~[@ast::item]) -> @ast::item; fn item_ty_poly(&self, span: Span, - name: ident, + name: Ident, ty: ast::Ty, generics: Generics) -> @ast::item; - fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item; + fn item_ty(&self, span: Span, name: Ident, ty: ast::Ty) -> @ast::item; fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute; @@ -225,25 +225,25 @@ pub trait AstBuilder { fn view_use(&self, sp: Span, vis: ast::visibility, vp: ~[@ast::view_path]) -> ast::view_item; fn view_use_list(&self, sp: Span, vis: ast::visibility, - path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item; + path: ~[ast::Ident], imports: &[ast::Ident]) -> ast::view_item; fn view_use_glob(&self, sp: Span, - vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item; + vis: ast::visibility, path: ~[ast::Ident]) -> ast::view_item; } impl AstBuilder for @ExtCtxt { - fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path { + fn path(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path { self.path_all(span, false, strs, None, ~[]) } - fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path { + fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path { self.path(span, ~[id]) } - fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path { + fn path_global(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path { self.path_all(span, true, strs, None, ~[]) } fn path_all(&self, sp: Span, global: bool, - mut idents: ~[ast::ident], + mut idents: ~[ast::Ident], rp: Option, types: ~[ast::Ty]) -> ast::Path { @@ -291,7 +291,7 @@ impl AstBuilder for @ExtCtxt { // Might need to take bounds as an argument in the future, if you ever want // to generate a bounded existential trait type. - fn ty_ident(&self, span: Span, ident: ast::ident) + fn ty_ident(&self, span: Span, ident: ast::Ident) -> ast::Ty { self.ty_path(self.path_ident(span, ident), None) } @@ -326,7 +326,7 @@ impl AstBuilder for @ExtCtxt { ~[ ty ]), None) } - fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField { + fn ty_field_imm(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::TypeField { ast::TypeField { ident: name, mt: ast::mt { ty: ~ty, mutbl: ast::m_imm }, @@ -346,7 +346,7 @@ impl AstBuilder for @ExtCtxt { } } - fn typaram(&self, id: ast::ident, bounds: OptVec) -> ast::TyParam { + fn typaram(&self, id: ast::Ident, bounds: OptVec) -> ast::TyParam { ast::TyParam { ident: id, id: self.next_id(), bounds: bounds } } @@ -385,7 +385,7 @@ impl AstBuilder for @ExtCtxt { ast::TraitTyParamBound(self.trait_ref(path)) } - fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime { + fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime { ast::Lifetime { id: self.next_id(), span: span, ident: ident } } @@ -393,7 +393,7 @@ impl AstBuilder for @ExtCtxt { @respan(expr.span, ast::stmt_semi(expr, self.next_id())) } - fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt { + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::expr) -> @ast::stmt { let pat = self.pat_ident(sp, ident); let local = @ast::Local { is_mutbl: mutbl, @@ -410,7 +410,7 @@ impl AstBuilder for @ExtCtxt { fn stmt_let_typed(&self, sp: Span, mutbl: bool, - ident: ast::ident, + ident: ast::Ident, typ: ast::Ty, ex: @ast::expr) -> @ast::stmt { @@ -461,7 +461,7 @@ impl AstBuilder for @ExtCtxt { self.expr(path.span, ast::expr_path(path)) } - fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr { + fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::expr { self.expr_path(self.path_ident(span, id)) } fn expr_self(&self, span: Span) -> @ast::expr { @@ -485,7 +485,7 @@ impl AstBuilder for @ExtCtxt { self.expr_unary(sp, ast::box(ast::m_imm), e) } - fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr { + fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr { self.expr(sp, ast::expr_field(expr, ident, ~[])) } fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr { @@ -498,18 +498,18 @@ impl AstBuilder for @ExtCtxt { fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr { self.expr(span, ast::expr_call(expr, args, ast::NoSugar)) } - fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr { + fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::expr]) -> @ast::expr { self.expr(span, ast::expr_call(self.expr_ident(span, id), args, ast::NoSugar)) } - fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident], + fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident], args: ~[@ast::expr]) -> @ast::expr { let pathexpr = self.expr_path(self.path_global(sp, fn_path)); self.expr_call(sp, pathexpr, args) } fn expr_method_call(&self, span: Span, expr: @ast::expr, - ident: ast::ident, + ident: ast::Ident, args: ~[@ast::expr]) -> @ast::expr { self.expr(span, ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar)) @@ -517,14 +517,14 @@ impl AstBuilder for @ExtCtxt { fn expr_block(&self, b: ast::Block) -> @ast::expr { self.expr(b.span, ast::expr_block(b)) } - fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field { + fn field_imm(&self, span: Span, name: Ident, e: @ast::expr) -> ast::Field { ast::Field { ident: name, expr: e, span: span } } fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr { self.expr(span, ast::expr_struct(path, fields, None)) } fn expr_struct_ident(&self, span: Span, - id: ast::ident, fields: ~[ast::Field]) -> @ast::expr { + id: ast::Ident, fields: ~[ast::Field]) -> @ast::expr { self.expr_struct(span, self.path_ident(span, id), fields) } @@ -591,13 +591,13 @@ impl AstBuilder for @ExtCtxt { fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat { self.pat(span, ast::pat_lit(expr)) } - fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat { + fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::pat { self.pat_ident_binding_mode(span, ident, ast::bind_infer) } fn pat_ident_binding_mode(&self, span: Span, - ident: ast::ident, + ident: ast::Ident, bm: ast::binding_mode) -> @ast::pat { let path = self.path_ident(span, ident); let pat = ast::pat_ident(bm, path, None); @@ -638,7 +638,7 @@ impl AstBuilder for @ExtCtxt { fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr { self.expr(span, ast::expr_fn_block(fn_decl, blk)) } - fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr { + fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::expr { let fn_decl = self.fn_decl( ids.map(|id| self.arg(span, *id, self.ty_infer(span))), self.ty_infer(span)); @@ -658,38 +658,38 @@ impl AstBuilder for @ExtCtxt { } #[cfg(stage0)] - fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr { + fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr { let ext_cx = *self; let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(|$ident| $blk_e ) } #[cfg(not(stage0))] - fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr { + fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr { let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(*self, |$ident| $blk_e ) } - fn lambda_expr(&self, span: Span, ids: ~[ast::ident], expr: @ast::expr) -> @ast::expr { + fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], expr: @ast::expr) -> @ast::expr { self.lambda(span, ids, self.block_expr(expr)) } fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr { self.lambda0(span, self.block_expr(expr)) } - fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr { + fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr { self.lambda1(span, self.block_expr(expr), ident) } - fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], stmts: ~[@ast::stmt]) -> @ast::expr { + fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], stmts: ~[@ast::stmt]) -> @ast::expr { self.lambda(span, ids, self.block(span, stmts, None)) } fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr { self.lambda0(span, self.block(span, stmts, None)) } - fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr { + fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::Ident) -> @ast::expr { self.lambda1(span, self.block(span, stmts, None), ident) } - fn arg(&self, span: Span, ident: ast::ident, ty: ast::Ty) -> ast::arg { + fn arg(&self, span: Span, ident: ast::Ident, ty: ast::Ty) -> ast::arg { let arg_pat = self.pat_ident(span, ident); ast::arg { is_mutbl: false, @@ -709,7 +709,7 @@ impl AstBuilder for @ExtCtxt { } fn item(&self, span: Span, - name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item { + name: Ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item { // XXX: Would be nice if our generated code didn't violate // Rust coding conventions @ast::item { ident: name, @@ -722,7 +722,7 @@ impl AstBuilder for @ExtCtxt { fn item_fn_poly(&self, span: Span, - name: ident, + name: Ident, inputs: ~[ast::arg], output: ast::Ty, generics: Generics, @@ -739,7 +739,7 @@ impl AstBuilder for @ExtCtxt { fn item_fn(&self, span: Span, - name: ident, + name: Ident, inputs: ~[ast::arg], output: ast::Ty, body: ast::Block @@ -753,7 +753,7 @@ impl AstBuilder for @ExtCtxt { body) } - fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant { + fn variant(&self, span: Span, name: Ident, tys: ~[ast::Ty]) -> ast::variant { let args = tys.move_iter().map(|ty| { ast::variant_arg { ty: ty, id: self.next_id() } }).collect(); @@ -769,13 +769,13 @@ impl AstBuilder for @ExtCtxt { }) } - fn item_enum_poly(&self, span: Span, name: ident, + fn item_enum_poly(&self, span: Span, name: Ident, enum_definition: ast::enum_def, generics: Generics) -> @ast::item { self.item(span, name, ~[], ast::item_enum(enum_definition, generics)) } - fn item_enum(&self, span: Span, name: ident, + fn item_enum(&self, span: Span, name: Ident, enum_definition: ast::enum_def) -> @ast::item { self.item_enum_poly(span, name, enum_definition, ast_util::empty_generics()) @@ -784,7 +784,7 @@ impl AstBuilder for @ExtCtxt { fn item_struct( &self, span: Span, - name: ident, + name: Ident, struct_def: ast::struct_def ) -> @ast::item { self.item_struct_poly( @@ -798,14 +798,14 @@ impl AstBuilder for @ExtCtxt { fn item_struct_poly( &self, span: Span, - name: ident, + name: Ident, struct_def: ast::struct_def, generics: Generics ) -> @ast::item { self.item(span, name, ~[], ast::item_struct(@struct_def, generics)) } - fn item_mod(&self, span: Span, name: ident, + fn item_mod(&self, span: Span, name: Ident, attrs: ~[ast::Attribute], vi: ~[ast::view_item], items: ~[@ast::item]) -> @ast::item { @@ -820,12 +820,12 @@ impl AstBuilder for @ExtCtxt { ) } - fn item_ty_poly(&self, span: Span, name: ident, ty: ast::Ty, + fn item_ty_poly(&self, span: Span, name: Ident, ty: ast::Ty, generics: Generics) -> @ast::item { self.item(span, name, ~[], ast::item_ty(ty, generics)) } - fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item { + fn item_ty(&self, span: Span, name: Ident, ty: ast::Ty) -> @ast::item { self.item_ty_poly(span, name, ty, ast_util::empty_generics()) } @@ -858,7 +858,7 @@ impl AstBuilder for @ExtCtxt { } fn view_use_list(&self, sp: Span, vis: ast::visibility, - path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item { + path: ~[ast::Ident], imports: &[ast::Ident]) -> ast::view_item { let imports = do imports.map |id| { respan(sp, ast::path_list_ident_ { name: *id, id: self.next_id() }) }; @@ -871,7 +871,7 @@ impl AstBuilder for @ExtCtxt { } fn view_use_glob(&self, sp: Span, - vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item { + vis: ast::visibility, path: ~[ast::Ident]) -> ast::view_item { self.view_use(sp, vis, ~[@respan(sp, ast::view_path_glob(self.path(sp, path), self.next_id()))]) diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index c8853e36cdd0c..eb05f87a8ceac 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -163,7 +163,7 @@ StaticEnum(, ~[(, Left(1)), */ use ast; -use ast::{enum_def, expr, ident, Generics, struct_def}; +use ast::{enum_def, expr, Ident, Generics, struct_def}; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -216,9 +216,9 @@ pub struct MethodDef<'self> { /// All the data about the data structure/method being derived upon. pub struct Substructure<'self> { /// ident of self - type_ident: ident, + type_ident: Ident, /// ident of the method - method_ident: ident, + method_ident: Ident, /// dereferenced access to any Self or Ptr(Self, _) arguments self_args: &'self [@expr], /// verbatim access to any other arguments @@ -234,26 +234,26 @@ pub enum SubstructureFields<'self> { ident is the ident of the current field (`None` for all fields in tuple structs). */ - Struct(~[(Option, @expr, ~[@expr])]), + Struct(~[(Option, @expr, ~[@expr])]), /** Matching variants of the enum: variant index, ast::variant, fields: `(field ident, self, [others])`, where the field ident is only non-`None` in the case of a struct variant. */ - EnumMatching(uint, &'self ast::variant, ~[(Option, @expr, ~[@expr])]), + EnumMatching(uint, &'self ast::variant, ~[(Option, @expr, ~[@expr])]), /** non-matching variants of the enum, [(variant index, ast::variant, [field ident, fields])] (i.e. all fields for self are in the first tuple, for other1 are in the second tuple, etc.) */ - EnumNonMatching(&'self [(uint, ast::variant, ~[(Option, @expr)])]), + EnumNonMatching(&'self [(uint, ast::variant, ~[(Option, @expr)])]), /// A static method where Self is a struct - StaticStruct(&'self ast::struct_def, Either), + StaticStruct(&'self ast::struct_def, Either), /// A static method where Self is an enum - StaticEnum(&'self ast::enum_def, ~[(ident, Either)]) + StaticEnum(&'self ast::enum_def, ~[(Ident, Either)]) } @@ -273,7 +273,7 @@ representing each variant: (variant index, ast::variant instance, pub type EnumNonMatchFunc<'self> = &'self fn(@ExtCtxt, Span, &[(uint, ast::variant, - ~[(Option, @expr)])], + ~[(Option, @expr)])], &[@expr]) -> @expr; @@ -315,7 +315,7 @@ impl<'self> TraitDef<'self> { * */ fn create_derived_impl(&self, cx: @ExtCtxt, span: Span, - type_ident: ident, generics: &Generics, + type_ident: Ident, generics: &Generics, methods: ~[@ast::method]) -> @ast::item { let trait_path = self.path.to_path(cx, span, type_ident, generics); @@ -375,7 +375,7 @@ impl<'self> TraitDef<'self> { fn expand_struct_def(&self, cx: @ExtCtxt, span: Span, struct_def: &struct_def, - type_ident: ident, + type_ident: Ident, generics: &Generics) -> @ast::item { let methods = do self.methods.map |method_def| { let (explicit_self, self_args, nonself_args, tys) = @@ -406,7 +406,7 @@ impl<'self> TraitDef<'self> { fn expand_enum_def(&self, cx: @ExtCtxt, span: Span, enum_def: &enum_def, - type_ident: ident, + type_ident: Ident, generics: &Generics) -> @ast::item { let methods = do self.methods.map |method_def| { let (explicit_self, self_args, nonself_args, tys) = @@ -439,7 +439,7 @@ impl<'self> MethodDef<'self> { fn call_substructure_method(&self, cx: @ExtCtxt, span: Span, - type_ident: ident, + type_ident: Ident, self_args: &[@expr], nonself_args: &[@expr], fields: &SubstructureFields) @@ -456,7 +456,7 @@ impl<'self> MethodDef<'self> { } fn get_ret_ty(&self, cx: @ExtCtxt, span: Span, - generics: &Generics, type_ident: ident) -> ast::Ty { + generics: &Generics, type_ident: Ident) -> ast::Ty { self.ret_ty.to_ty(cx, span, type_ident, generics) } @@ -465,8 +465,8 @@ impl<'self> MethodDef<'self> { } fn split_self_nonself_args(&self, cx: @ExtCtxt, span: Span, - type_ident: ident, generics: &Generics) - -> (ast::explicit_self, ~[@expr], ~[@expr], ~[(ident, ast::Ty)]) { + type_ident: Ident, generics: &Generics) + -> (ast::explicit_self, ~[@expr], ~[@expr], ~[(Ident, ast::Ty)]) { let mut self_args = ~[]; let mut nonself_args = ~[]; @@ -511,10 +511,10 @@ impl<'self> MethodDef<'self> { } fn create_method(&self, cx: @ExtCtxt, span: Span, - type_ident: ident, + type_ident: Ident, generics: &Generics, explicit_self: ast::explicit_self, - arg_types: ~[(ident, ast::Ty)], + arg_types: ~[(Ident, ast::Ty)], body: @expr) -> @ast::method { // create the generics that aren't for Self let fn_generics = self.generics.to_generics(cx, span, type_ident, generics); @@ -571,7 +571,7 @@ impl<'self> MethodDef<'self> { cx: @ExtCtxt, span: Span, struct_def: &struct_def, - type_ident: ident, + type_ident: Ident, self_args: &[@expr], nonself_args: &[@expr]) -> @expr { @@ -625,7 +625,7 @@ impl<'self> MethodDef<'self> { cx: @ExtCtxt, span: Span, struct_def: &struct_def, - type_ident: ident, + type_ident: Ident, self_args: &[@expr], nonself_args: &[@expr]) -> @expr { @@ -667,7 +667,7 @@ impl<'self> MethodDef<'self> { cx: @ExtCtxt, span: Span, enum_def: &enum_def, - type_ident: ident, + type_ident: Ident, self_args: &[@expr], nonself_args: &[@expr]) -> @expr { @@ -702,12 +702,12 @@ impl<'self> MethodDef<'self> { fn build_enum_match(&self, cx: @ExtCtxt, span: Span, enum_def: &enum_def, - type_ident: ident, + type_ident: Ident, self_args: &[@expr], nonself_args: &[@expr], matching: Option, matches_so_far: &mut ~[(uint, ast::variant, - ~[(Option, @expr)])], + ~[(Option, @expr)])], match_count: uint) -> @expr { if match_count == self_args.len() { // we've matched against all arguments, so make the final @@ -852,7 +852,7 @@ impl<'self> MethodDef<'self> { cx: @ExtCtxt, span: Span, enum_def: &enum_def, - type_ident: ident, + type_ident: Ident, self_args: &[@expr], nonself_args: &[@expr]) -> @expr { @@ -874,7 +874,7 @@ impl<'self> MethodDef<'self> { } fn summarise_struct(cx: @ExtCtxt, span: Span, - struct_def: &struct_def) -> Either { + struct_def: &struct_def) -> Either { let mut named_idents = ~[]; let mut unnamed_count = 0; for field in struct_def.fields.iter() { @@ -913,11 +913,11 @@ enum StructType { fn create_struct_pattern(cx: @ExtCtxt, span: Span, - struct_ident: ident, + struct_ident: Ident, struct_def: &struct_def, prefix: &str, mutbl: ast::mutability) - -> (@ast::pat, ~[(Option, @expr)]) { + -> (@ast::pat, ~[(Option, @expr)]) { if struct_def.fields.is_empty() { return ( cx.pat_ident_binding_mode( @@ -977,7 +977,7 @@ fn create_enum_variant_pattern(cx: @ExtCtxt, variant: &ast::variant, prefix: &str, mutbl: ast::mutability) - -> (@ast::pat, ~[(Option, @expr)]) { + -> (@ast::pat, ~[(Option, @expr)]) { let variant_ident = variant.node.name; match variant.node.kind { diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 0123044478c2a..7fd44bfad01f2 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -18,7 +18,7 @@ library. */ -use ast::{enum_def, ident, item, Generics, struct_def}; +use ast::{enum_def, Ident, item, Generics, struct_def}; use ast::{MetaItem, MetaList, MetaNameValue, MetaWord}; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -47,13 +47,13 @@ pub mod generic; pub type ExpandDerivingStructDefFn<'self> = &'self fn(@ExtCtxt, Span, x: &struct_def, - ident, + Ident, y: &Generics) -> @item; pub type ExpandDerivingEnumDefFn<'self> = &'self fn(@ExtCtxt, Span, x: &enum_def, - ident, + Ident, y: &Generics) -> @item; diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 485df6084a890..b24c8eb84abdd 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{MetaItem, item, expr, ident}; +use ast::{MetaItem, item, expr, Ident}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::{AstBuilder, Duplicate}; @@ -129,8 +129,8 @@ fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { }; fn rand_thing(cx: @ExtCtxt, span: Span, - ctor_ident: ident, - summary: &Either, + ctor_ident: Ident, + summary: &Either, rand_call: &fn() -> @expr) -> @expr { match *summary { Left(count) => { diff --git a/src/libsyntax/ext/deriving/to_str.rs b/src/libsyntax/ext/deriving/to_str.rs index 1b136983de8d7..eecce06f69f0b 100644 --- a/src/libsyntax/ext/deriving/to_str.rs +++ b/src/libsyntax/ext/deriving/to_str.rs @@ -47,8 +47,8 @@ fn to_str_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let to_str = cx.ident_of("to_str"); - let doit = |start: &str, end: @str, name: ast::ident, - fields: &[(Option, @expr, ~[@expr])]| { + let doit = |start: &str, end: @str, name: ast::Ident, + fields: &[(Option, @expr, ~[@expr])]| { if fields.len() == 0 { cx.expr_str_uniq(span, cx.str_of(name)) } else { diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index f0b22d9b28876..6c1b8100f4204 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -14,7 +14,7 @@ explicit `Self` type to use when specifying impls to be derived. */ use ast; -use ast::{expr,Generics,ident}; +use ast::{expr,Generics,Ident}; use ext::base::ExtCtxt; use ext::build::AstBuilder; use codemap::{Span,respan}; @@ -59,7 +59,7 @@ impl<'self> Path<'self> { pub fn to_ty(&self, cx: @ExtCtxt, span: Span, - self_ty: ident, + self_ty: Ident, self_generics: &Generics) -> ast::Ty { cx.ty_path(self.to_path(cx, span, self_ty, self_generics), None) @@ -67,7 +67,7 @@ impl<'self> Path<'self> { pub fn to_path(&self, cx: @ExtCtxt, span: Span, - self_ty: ident, + self_ty: Ident, self_generics: &Generics) -> ast::Path { let idents = self.path.map(|s| cx.ident_of(*s) ); @@ -120,7 +120,7 @@ impl<'self> Ty<'self> { pub fn to_ty(&self, cx: @ExtCtxt, span: Span, - self_ty: ident, + self_ty: Ident, self_generics: &Generics) -> ast::Ty { match *self { @@ -158,7 +158,7 @@ impl<'self> Ty<'self> { pub fn to_path(&self, cx: @ExtCtxt, span: Span, - self_ty: ident, + self_ty: Ident, self_generics: &Generics) -> ast::Path { match *self { @@ -186,7 +186,7 @@ impl<'self> Ty<'self> { fn mk_ty_param(cx: @ExtCtxt, span: Span, name: &str, bounds: &[Path], - self_ident: ident, self_generics: &Generics) -> ast::TyParam { + self_ident: Ident, self_generics: &Generics) -> ast::TyParam { let bounds = opt_vec::from( do bounds.map |b| { let path = b.to_path(cx, span, self_ident, self_generics); @@ -217,7 +217,7 @@ impl<'self> LifetimeBounds<'self> { pub fn to_generics(&self, cx: @ExtCtxt, span: Span, - self_ty: ident, + self_ty: Ident, self_generics: &Generics) -> Generics { let lifetimes = do self.lifetimes.map |lt| { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index eb1eaffe75728..0827a9fabee5c 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{Block, Crate, NodeId, expr_, expr_mac, ident, mac_invoc_tt}; +use ast::{Block, Crate, NodeId, expr_, expr_mac, Ident, mac_invoc_tt}; use ast::{item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi}; use ast::{illegal_ctxt}; use ast; @@ -140,7 +140,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, } } - fn mk_simple_path(ident: ast::ident, span: Span) -> ast::Path { + fn mk_simple_path(ident: ast::Ident, span: Span) -> ast::Path { ast::Path { span: span, global: false, @@ -523,7 +523,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, #[deriving(Clone)] struct NewNameFinderContext { - ident_accumulator: @mut ~[ast::ident], + ident_accumulator: @mut ~[ast::Ident], } impl Visitor<()> for NewNameFinderContext { @@ -645,7 +645,7 @@ impl Visitor<()> for NewNameFinderContext { fn visit_struct_def(&mut self, struct_def: @ast::struct_def, - ident: ident, + ident: Ident, generics: &ast::Generics, node_id: NodeId, _: ()) { @@ -667,7 +667,7 @@ impl Visitor<()> for NewNameFinderContext { // return a visitor that extracts the pat_ident paths // from a given pattern and puts them in a mutable // array (passed in to the traversal) -pub fn new_name_finder(idents: @mut ~[ast::ident]) -> @mut Visitor<()> { +pub fn new_name_finder(idents: @mut ~[ast::Ident]) -> @mut Visitor<()> { let context = @mut NewNameFinderContext { ident_accumulator: idents, }; @@ -697,7 +697,7 @@ fn get_block_info(exts : SyntaxEnv) -> BlockInfo { // given a mutable list of renames, return a tree-folder that applies those // renames. -fn renames_to_fold(renames : @mut ~[(ast::ident,ast::Name)]) -> @ast_fold { +fn renames_to_fold(renames : @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold { let afp = default_ast_fold(); let f_pre = @AstFoldFns { fold_ident: |id,_| { @@ -706,7 +706,7 @@ fn renames_to_fold(renames : @mut ~[(ast::ident,ast::Name)]) -> @ast_fold { let new_ctxt = renames.iter().fold(id.ctxt,|ctxt,&(from,to)| { new_rename(from,to,ctxt) }); - ast::ident{name:id.name,ctxt:new_ctxt} + ast::Ident{name:id.name,ctxt:new_ctxt} }, .. *afp }; @@ -1144,7 +1144,7 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess, // given a function from idents to idents, produce // an ast_fold that applies that function: -pub fn fun_to_ident_folder(f: @fn(ast::ident)->ast::ident) -> @ast_fold{ +pub fn fun_to_ident_folder(f: @fn(ast::Ident)->ast::Ident) -> @ast_fold{ let afp = default_ast_fold(); let f_pre = @AstFoldFns{ fold_ident : |id, _| f(id), @@ -1154,11 +1154,11 @@ pub fn fun_to_ident_folder(f: @fn(ast::ident)->ast::ident) -> @ast_fold{ } // update the ctxts in a path to get a rename node -pub fn new_ident_renamer(from: ast::ident, +pub fn new_ident_renamer(from: ast::Ident, to: ast::Name) -> - @fn(ast::ident)->ast::ident { - |id : ast::ident| - ast::ident{ + @fn(ast::Ident)->ast::Ident { + |id : ast::Ident| + ast::Ident{ name: id.name, ctxt: new_rename(from,to,id.ctxt) } @@ -1167,9 +1167,9 @@ pub fn new_ident_renamer(from: ast::ident, // update the ctxts in a path to get a mark node pub fn new_ident_marker(mark: uint) -> - @fn(ast::ident)->ast::ident { - |id : ast::ident| - ast::ident{ + @fn(ast::Ident)->ast::Ident { + |id : ast::Ident| + ast::Ident{ name: id.name, ctxt: new_mark(mark,id.ctxt) } @@ -1178,9 +1178,9 @@ pub fn new_ident_marker(mark: uint) -> // perform resolution (in the MTWT sense) on all of the // idents in the tree. This is the final step in expansion. pub fn new_ident_resolver() -> - @fn(ast::ident)->ast::ident { - |id : ast::ident| - ast::ident { + @fn(ast::Ident)->ast::Ident { + |id : ast::Ident| + ast::Ident { name : resolve(id), ctxt : illegal_ctxt } @@ -1304,7 +1304,7 @@ mod test { }; let a_name = intern("a"); let a2_name = intern("a2"); - let renamer = new_ident_renamer(ast::ident{name:a_name,ctxt:empty_ctxt}, + let renamer = new_ident_renamer(ast::Ident{name:a_name,ctxt:empty_ctxt}, a2_name); let renamed_ast = fun_to_ident_folder(renamer).fold_item(item_ast).unwrap(); let resolver = new_ident_resolver(); diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 4bfb4da7a49da..4e7275b75c8ef 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -50,7 +50,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) fn pieces_to_expr(cx: @ExtCtxt, sp: Span, pieces: ~[Piece], args: ~[@ast::expr]) -> @ast::expr { - fn make_path_vec(ident: &str) -> ~[ast::ident] { + fn make_path_vec(ident: &str) -> ~[ast::Ident] { return ~[str_to_ident("std"), str_to_ident("unstable"), str_to_ident("extfmt"), diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs index eab5f65777551..474c0ce60a782 100644 --- a/src/libsyntax/ext/ifmt.rs +++ b/src/libsyntax/ext/ifmt.rs @@ -637,7 +637,7 @@ impl Context { } fn format_arg(&self, sp: Span, arg: Either, - ident: ast::ident) -> @ast::expr { + ident: ast::Ident) -> @ast::expr { let ty = match arg { Left(i) => self.arg_types[i].unwrap(), Right(s) => *self.name_types.get(&s) diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 05e639632ede0..bea18d868a0d1 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -68,7 +68,7 @@ pub mod rt { fn to_source(&self) -> @str; } - impl ToSource for ast::ident { + impl ToSource for ast::Ident { fn to_source(&self) -> @str { ident_to_str(self) } @@ -216,7 +216,7 @@ pub mod rt { ) ) - impl_to_tokens!(ast::ident) + impl_to_tokens!(ast::Ident) impl_to_tokens!(@ast::item) impl_to_tokens_self!(&'self [@ast::item]) impl_to_tokens!(ast::Ty) @@ -334,16 +334,16 @@ pub fn expand_quote_stmt(cx: @ExtCtxt, ~[e_attrs], tts)) } -fn ids_ext(strs: ~[~str]) -> ~[ast::ident] { +fn ids_ext(strs: ~[~str]) -> ~[ast::Ident] { strs.map(|str| str_to_ident(*str)) } -fn id_ext(str: &str) -> ast::ident { +fn id_ext(str: &str) -> ast::Ident { str_to_ident(str) } // Lift an ident to the expr that evaluates to that ident. -fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::ident) -> @ast::expr { +fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::expr { let e_str = cx.expr_str(sp, cx.str_of(ident)); cx.expr_method_call(sp, cx.expr_ident(sp, id_ext("ext_cx")), diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index bc4b1010943a1..7a9e916421c0f 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -11,7 +11,7 @@ // Earley-like parser for macros. use ast; -use ast::{matcher, match_tok, match_seq, match_nonterminal, ident}; +use ast::{matcher, match_tok, match_seq, match_nonterminal, Ident}; use codemap::{BytePos, mk_sp}; use codemap; use parse::lexer::*; //resolve bug? @@ -189,9 +189,9 @@ pub enum named_match { pub type earley_item = ~MatcherPos; pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match]) - -> HashMap { + -> HashMap { fn n_rec(p_s: @mut ParseSess, m: &matcher, res: &[@named_match], - ret_val: &mut HashMap) { + ret_val: &mut HashMap) { match *m { codemap::Spanned {node: match_tok(_), _} => (), codemap::Spanned {node: match_seq(ref more_ms, _, _, _, _), _} => { @@ -216,7 +216,7 @@ pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match]) } pub enum parse_result { - success(HashMap), + success(HashMap), failure(codemap::Span, ~str), error(codemap::Span, ~str) } @@ -226,7 +226,7 @@ pub fn parse_or_else( cfg: ast::CrateConfig, rdr: @mut reader, ms: ~[matcher] -) -> HashMap { +) -> HashMap { match parse(sess, cfg, rdr, ms) { success(m) => m, failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str), diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index f336098468b5b..732ae2ccb9608 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; +use ast::{Ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; use ast::{tt_delim}; use ast; use codemap::{Span, Spanned, dummy_sp}; @@ -25,7 +25,7 @@ use print; pub fn add_new_extension(cx: @ExtCtxt, sp: Span, - name: ident, + name: Ident, arg: ~[ast::token_tree]) -> base::MacResult { // these spans won't matter, anyways @@ -74,7 +74,7 @@ pub fn add_new_extension(cx: @ExtCtxt, }; // Given `lhses` and `rhses`, this is the new macro we create - fn generic_extension(cx: @ExtCtxt, sp: Span, name: ident, + fn generic_extension(cx: @ExtCtxt, sp: Span, name: Ident, arg: &[ast::token_tree], lhses: &[@named_match], rhses: &[@named_match]) -> MacResult { diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 668805bf7a8e7..8a858f3d9858f 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident}; +use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,Ident}; use codemap::{Span, dummy_sp}; use diagnostic::span_handler; use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; @@ -34,7 +34,7 @@ pub struct TtReader { // the unzipped tree: stack: @mut TtFrame, /* for MBE-style macro transcription */ - interpolations: HashMap, + interpolations: HashMap, repeat_idx: ~[uint], repeat_len: ~[uint], /* cached: */ @@ -46,7 +46,7 @@ pub struct TtReader { * `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and * should) be none. */ pub fn new_tt_reader(sp_diag: @mut span_handler, - interp: Option>, + interp: Option>, src: ~[ast::token_tree]) -> @mut TtReader { let r = @mut TtReader { @@ -113,7 +113,7 @@ fn lookup_cur_matched_by_matched(r: &mut TtReader, r.repeat_idx.iter().fold(start, red) } -fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match { +fn lookup_cur_matched(r: &mut TtReader, name: Ident) -> @named_match { match r.interpolations.find_copy(&name) { Some(s) => lookup_cur_matched_by_matched(r, s), None => { @@ -126,7 +126,7 @@ fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match { #[deriving(Clone)] enum lis { lis_unconstrained, - lis_constraint(uint, ident), + lis_constraint(uint, Ident), lis_contradiction(~str), } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 98ef4e89027cb..7e3695614ae38 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -32,7 +32,7 @@ pub trait ast_fold { fn fold_mod(@self, &_mod) -> _mod; fn fold_foreign_mod(@self, &foreign_mod) -> foreign_mod; fn fold_variant(@self, &variant) -> variant; - fn fold_ident(@self, ident) -> ident; + fn fold_ident(@self, Ident) -> Ident; fn fold_path(@self, &Path) -> Path; fn fold_local(@self, @Local) -> @Local; fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr]; @@ -61,7 +61,7 @@ pub struct AstFoldFns { fold_mod: @fn(&_mod, @ast_fold) -> _mod, fold_foreign_mod: @fn(&foreign_mod, @ast_fold) -> foreign_mod, fold_variant: @fn(&variant_, Span, @ast_fold) -> (variant_, Span), - fold_ident: @fn(ident, @ast_fold) -> ident, + fold_ident: @fn(Ident, @ast_fold) -> Ident, fold_path: @fn(&Path, @ast_fold) -> Path, fold_local: @fn(@Local, @ast_fold) -> @Local, map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr], @@ -758,7 +758,7 @@ fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ { } } -fn noop_fold_ident(i: ident, _fld: @ast_fold) -> ident { +fn noop_fold_ident(i: Ident, _fld: @ast_fold) -> Ident { i } @@ -913,7 +913,7 @@ impl ast_fold for AstFoldFns { let (n, s) = (self.fold_variant)(&x.node, x.span, self as @ast_fold); Spanned { node: n, span: (self.new_span)(s) } } - fn fold_ident(@self, x: ident) -> ident { + fn fold_ident(@self, x: Ident) -> Ident { (self.fold_ident)(x, self as @ast_fold) } fn fold_path(@self, x: &Path) -> Path { @@ -961,7 +961,7 @@ mod test { // taken from expand // given a function from idents to idents, produce // an ast_fold that applies that function: - pub fn fun_to_ident_folder(f: @fn(ast::ident)->ast::ident) -> @ast_fold{ + pub fn fun_to_ident_folder(f: @fn(ast::Ident)->ast::Ident) -> @ast_fold{ let afp = default_ast_fold(); let f_pre = @AstFoldFns{ fold_ident : |id, _| f(id), @@ -976,7 +976,7 @@ mod test { } // change every identifier to "zz" - pub fn to_zz() -> @fn(ast::ident)->ast::ident { + pub fn to_zz() -> @fn(ast::Ident)->ast::Ident { let zz_id = token::str_to_ident("zz"); |_id| {zz_id} } diff --git a/src/libsyntax/oldvisit.rs b/src/libsyntax/oldvisit.rs index 1c7e9d6619106..ac3a2d1316fbf 100644 --- a/src/libsyntax/oldvisit.rs +++ b/src/libsyntax/oldvisit.rs @@ -34,10 +34,10 @@ pub enum vt { mk_vt(visitor), } pub enum fn_kind<'self> { // fn foo() or extern "Abi" fn foo() - fk_item_fn(ident, &'self Generics, purity, AbiSet), + fk_item_fn(Ident, &'self Generics, purity, AbiSet), // fn foo(&self) - fk_method(ident, &'self Generics, &'self method), + fk_method(Ident, &'self Generics, &'self method), // @fn(x, y) { ... } fk_anon(ast::Sigil), @@ -46,7 +46,7 @@ pub enum fn_kind<'self> { fk_fn_block, } -pub fn name_of_fn(fk: &fn_kind) -> ident { +pub fn name_of_fn(fk: &fn_kind) -> Ident { match *fk { fk_item_fn(name, _, _, _) | fk_method(name, _, _) => { name @@ -88,7 +88,7 @@ pub struct Visitor { visit_fn: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId, (E, vt)), visit_ty_method: @fn(&TypeMethod, (E, vt)), visit_trait_method: @fn(&trait_method, (E, vt)), - visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId, (E, vt)), + visit_struct_def: @fn(@struct_def, Ident, &Generics, NodeId, (E, vt)), visit_struct_field: @fn(@struct_field, (E, vt)), } @@ -422,7 +422,7 @@ pub fn visit_trait_method(m: &trait_method, (e, v): (E, vt)) { pub fn visit_struct_def( sd: @struct_def, - _nm: ast::ident, + _nm: ast::Ident, _generics: &Generics, _id: NodeId, (e, v): (E, vt) @@ -612,7 +612,7 @@ pub struct SimpleVisitor { visit_fn: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId), visit_ty_method: @fn(&TypeMethod), visit_trait_method: @fn(&trait_method), - visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId), + visit_struct_def: @fn(@struct_def, Ident, &Generics, NodeId), visit_struct_field: @fn(@struct_field), visit_struct_method: @fn(@method) } @@ -715,9 +715,9 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> { visit_trait_method(m, (e, v)); } fn v_struct_def( - f: @fn(@struct_def, ident, &Generics, NodeId), + f: @fn(@struct_def, Ident, &Generics, NodeId), sd: @struct_def, - nm: ident, + nm: Ident, generics: &Generics, id: NodeId, (e, v): ((), vt<()>) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ea3437820a180..02af6d23b4415 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -34,7 +34,7 @@ use ast::{expr_vstore_slice, expr_vstore_box}; use ast::{expr_vstore_mut_slice, expr_while, expr_for_loop, extern_fn, Field, fn_decl}; use ast::{expr_vstore_uniq, Onceness, Once, Many}; use ast::{foreign_item, foreign_item_static, foreign_item_fn, foreign_mod}; -use ast::{ident, impure_fn, inherited, item, item_, item_static}; +use ast::{Ident, impure_fn, inherited, item, item_, item_static}; use ast::{item_enum, item_fn, item_foreign_mod, item_impl}; use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_}; use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int}; @@ -95,7 +95,7 @@ enum restriction { } type arg_or_capture_item = Either; -type item_info = (ident, item_, Option<~[Attribute]>); +type item_info = (Ident, item_, Option<~[Attribute]>); /// How to parse a path. There are four different kinds of paths, all of which /// are parsed somewhat differently. @@ -476,7 +476,7 @@ impl Parser { self.commit_stmt(s, &[edible], &[]) } - pub fn parse_ident(&self) -> ast::ident { + pub fn parse_ident(&self) -> ast::Ident { self.check_strict_keywords(); self.check_reserved_keywords(); match *self.token { @@ -756,7 +756,7 @@ impl Parser { } pub fn get_id(&self) -> NodeId { next_node_id(self.sess) } - pub fn id_to_str(&self, id: ident) -> @str { + pub fn id_to_str(&self, id: Ident) -> @str { get_ident_interner().get(id.name) } @@ -775,7 +775,7 @@ impl Parser { } } - pub fn get_lifetime(&self, tok: &token::Token) -> ast::ident { + pub fn get_lifetime(&self, tok: &token::Token) -> ast::Ident { match *tok { token::LIFETIME(ref ident) => *ident, _ => self.bug("not a lifetime"), @@ -1664,7 +1664,7 @@ impl Parser { pub fn mk_method_call(&self, rcvr: @expr, - ident: ident, + ident: Ident, tps: ~[Ty], args: ~[@expr], sugar: CallSugar) -> ast::expr_ { @@ -1675,7 +1675,7 @@ impl Parser { expr_index(self.get_id(), expr, idx) } - pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[Ty]) -> ast::expr_ { + pub fn mk_field(&self, expr: @expr, ident: Ident, tys: ~[Ty]) -> ast::expr_ { expr_field(expr, ident, tys) } @@ -2550,7 +2550,7 @@ impl Parser { return self.mk_expr(lo, hi, expr_while(cond, body)); } - pub fn parse_loop_expr(&self, opt_ident: Option) -> @expr { + pub fn parse_loop_expr(&self, opt_ident: Option) -> @expr { // loop headers look like 'loop {' or 'loop unsafe {' let is_loop_header = *self.token == token::LBRACE @@ -3713,13 +3713,13 @@ impl Parser { } // parse the name and optional generic types of a function header. - fn parse_fn_header(&self) -> (ident, ast::Generics) { + fn parse_fn_header(&self) -> (Ident, ast::Generics) { let id = self.parse_ident(); let generics = self.parse_generics(); (id, generics) } - fn mk_item(&self, lo: BytePos, hi: BytePos, ident: ident, + fn mk_item(&self, lo: BytePos, hi: BytePos, ident: Ident, node: item_, vis: visibility, attrs: ~[Attribute]) -> @item { @ast::item { ident: ident, @@ -4107,7 +4107,7 @@ impl Parser { } } - fn push_mod_path(&self, id: ident, attrs: &[Attribute]) { + fn push_mod_path(&self, id: Ident, attrs: &[Attribute]) { let default_path = token::interner_get(id.name); let file_path = match ::attr::first_attr_value_str_by_name(attrs, "path") { @@ -4123,7 +4123,7 @@ impl Parser { // read a module from a source file. fn eval_src_mod(&self, - id: ast::ident, + id: ast::Ident, outer_attrs: &[ast::Attribute], id_sp: Span) -> (ast::item_, ~[ast::Attribute]) { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 8128a4e905c16..3d47b1141ddd0 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -76,22 +76,22 @@ pub enum Token { LIT_INT(i64, ast::int_ty), LIT_UINT(u64, ast::uint_ty), LIT_INT_UNSUFFIXED(i64), - LIT_FLOAT(ast::ident, ast::float_ty), - LIT_FLOAT_UNSUFFIXED(ast::ident), - LIT_STR(ast::ident), + LIT_FLOAT(ast::Ident, ast::float_ty), + LIT_FLOAT_UNSUFFIXED(ast::Ident), + LIT_STR(ast::Ident), /* Name components */ // an identifier contains an "is_mod_name" boolean, // indicating whether :: follows this token with no // whitespace in between. - IDENT(ast::ident, bool), + IDENT(ast::Ident, bool), UNDERSCORE, - LIFETIME(ast::ident), + LIFETIME(ast::Ident), /* For interpolation */ INTERPOLATED(nonterminal), - DOC_COMMENT(ast::ident), + DOC_COMMENT(ast::Ident), EOF, } @@ -104,7 +104,7 @@ pub enum nonterminal { nt_pat( @ast::pat), nt_expr(@ast::expr), nt_ty( ~ast::Ty), - nt_ident(~ast::ident, bool), + nt_ident(~ast::Ident, bool), nt_attr(@ast::Attribute), // #[foo] nt_path(~ast::Path), nt_tt( @ast::token_tree), //needs @ed to break a circularity @@ -307,46 +307,46 @@ pub fn is_bar(t: &Token) -> bool { pub mod special_idents { - use ast::ident; + use ast::Ident; - pub static underscore : ident = ident { name: 0, ctxt: 0}; - pub static anon : ident = ident { name: 1, ctxt: 0}; - pub static invalid : ident = ident { name: 2, ctxt: 0}; // '' - pub static unary : ident = ident { name: 3, ctxt: 0}; - pub static not_fn : ident = ident { name: 4, ctxt: 0}; - pub static idx_fn : ident = ident { name: 5, ctxt: 0}; - pub static unary_minus_fn : ident = ident { name: 6, ctxt: 0}; - pub static clownshoes_extensions : ident = ident { name: 7, ctxt: 0}; + pub static underscore : Ident = Ident { name: 0, ctxt: 0}; + pub static anon : Ident = Ident { name: 1, ctxt: 0}; + pub static invalid : Ident = Ident { name: 2, ctxt: 0}; // '' + pub static unary : Ident = Ident { name: 3, ctxt: 0}; + pub static not_fn : Ident = Ident { name: 4, ctxt: 0}; + pub static idx_fn : Ident = Ident { name: 5, ctxt: 0}; + pub static unary_minus_fn : Ident = Ident { name: 6, ctxt: 0}; + pub static clownshoes_extensions : Ident = Ident { name: 7, ctxt: 0}; - pub static self_ : ident = ident { name: 8, ctxt: 0}; // 'self' + pub static self_ : Ident = Ident { name: 8, ctxt: 0}; // 'self' /* for matcher NTs */ - pub static item : ident = ident { name: 9, ctxt: 0}; - pub static block : ident = ident { name: 10, ctxt: 0}; - pub static stmt : ident = ident { name: 11, ctxt: 0}; - pub static pat : ident = ident { name: 12, ctxt: 0}; - pub static expr : ident = ident { name: 13, ctxt: 0}; - pub static ty : ident = ident { name: 14, ctxt: 0}; - pub static ident : ident = ident { name: 15, ctxt: 0}; - pub static path : ident = ident { name: 16, ctxt: 0}; - pub static tt : ident = ident { name: 17, ctxt: 0}; - pub static matchers : ident = ident { name: 18, ctxt: 0}; - - pub static str : ident = ident { name: 19, ctxt: 0}; // for the type + pub static item : Ident = Ident { name: 9, ctxt: 0}; + pub static block : Ident = Ident { name: 10, ctxt: 0}; + pub static stmt : Ident = Ident { name: 11, ctxt: 0}; + pub static pat : Ident = Ident { name: 12, ctxt: 0}; + pub static expr : Ident = Ident { name: 13, ctxt: 0}; + pub static ty : Ident = Ident { name: 14, ctxt: 0}; + pub static ident : Ident = Ident { name: 15, ctxt: 0}; + pub static path : Ident = Ident { name: 16, ctxt: 0}; + pub static tt : Ident = Ident { name: 17, ctxt: 0}; + pub static matchers : Ident = Ident { name: 18, ctxt: 0}; + + pub static str : Ident = Ident { name: 19, ctxt: 0}; // for the type /* outside of libsyntax */ - pub static arg : ident = ident { name: 20, ctxt: 0}; - pub static descrim : ident = ident { name: 21, ctxt: 0}; - pub static clownshoe_abi : ident = ident { name: 22, ctxt: 0}; - pub static clownshoe_stack_shim : ident = ident { name: 23, ctxt: 0}; - pub static main : ident = ident { name: 24, ctxt: 0}; - pub static opaque : ident = ident { name: 25, ctxt: 0}; - pub static blk : ident = ident { name: 26, ctxt: 0}; - pub static statik : ident = ident { name: 27, ctxt: 0}; - pub static clownshoes_foreign_mod: ident = ident { name: 28, ctxt: 0}; - pub static unnamed_field: ident = ident { name: 29, ctxt: 0}; - pub static c_abi: ident = ident { name: 30, ctxt: 0}; - pub static type_self: ident = ident { name: 31, ctxt: 0}; // `Self` + pub static arg : Ident = Ident { name: 20, ctxt: 0}; + pub static descrim : Ident = Ident { name: 21, ctxt: 0}; + pub static clownshoe_abi : Ident = Ident { name: 22, ctxt: 0}; + pub static clownshoe_stack_shim : Ident = Ident { name: 23, ctxt: 0}; + pub static main : Ident = Ident { name: 24, ctxt: 0}; + pub static opaque : Ident = Ident { name: 25, ctxt: 0}; + pub static blk : Ident = Ident { name: 26, ctxt: 0}; + pub static statik : Ident = Ident { name: 27, ctxt: 0}; + pub static clownshoes_foreign_mod: Ident = Ident { name: 28, ctxt: 0}; + pub static unnamed_field: Ident = Ident { name: 29, ctxt: 0}; + pub static c_abi: Ident = Ident { name: 30, ctxt: 0}; + pub static type_self: Ident = Ident { name: 31, ctxt: 0}; // `Self` } /** @@ -525,18 +525,18 @@ pub fn interner_get(name : Name) -> @str { } // maps an identifier to the string that it corresponds to -pub fn ident_to_str(id : &ast::ident) -> @str { +pub fn ident_to_str(id : &ast::Ident) -> @str { interner_get(id.name) } // maps a string to an identifier with an empty syntax context -pub fn str_to_ident(str : &str) -> ast::ident { - ast::new_ident(intern(str)) +pub fn str_to_ident(str : &str) -> ast::Ident { + ast::Ident::new(intern(str)) } // maps a string to a gensym'ed identifier -pub fn gensym_ident(str : &str) -> ast::ident { - ast::new_ident(gensym(str)) +pub fn gensym_ident(str : &str) -> ast::Ident { + ast::Ident::new(gensym(str)) } @@ -561,7 +561,7 @@ pub fn fresh_name(src_name : &str) -> Name { * the language and may not appear as identifiers. */ pub mod keywords { - use ast::ident; + use ast::Ident; pub enum Keyword { // Strict keywords @@ -608,46 +608,46 @@ pub mod keywords { } impl Keyword { - pub fn to_ident(&self) -> ident { + pub fn to_ident(&self) -> Ident { match *self { - As => ident { name: 32, ctxt: 0 }, - Break => ident { name: 33, ctxt: 0 }, - Const => ident { name: 34, ctxt: 0 }, - Do => ident { name: 35, ctxt: 0 }, - Else => ident { name: 36, ctxt: 0 }, - Enum => ident { name: 37, ctxt: 0 }, - Extern => ident { name: 38, ctxt: 0 }, - False => ident { name: 39, ctxt: 0 }, - Fn => ident { name: 40, ctxt: 0 }, - For => ident { name: 41, ctxt: 0 }, - If => ident { name: 42, ctxt: 0 }, - Impl => ident { name: 43, ctxt: 0 }, - In => ident { name: 63, ctxt: 0 }, - Let => ident { name: 44, ctxt: 0 }, - __Log => ident { name: 45, ctxt: 0 }, - Loop => ident { name: 46, ctxt: 0 }, - Match => ident { name: 47, ctxt: 0 }, - Mod => ident { name: 48, ctxt: 0 }, - Mut => ident { name: 49, ctxt: 0 }, - Once => ident { name: 50, ctxt: 0 }, - Priv => ident { name: 51, ctxt: 0 }, - Pub => ident { name: 52, ctxt: 0 }, - Ref => ident { name: 53, ctxt: 0 }, - Return => ident { name: 54, ctxt: 0 }, - Static => ident { name: 27, ctxt: 0 }, - Self => ident { name: 8, ctxt: 0 }, - Struct => ident { name: 55, ctxt: 0 }, - Super => ident { name: 56, ctxt: 0 }, - True => ident { name: 57, ctxt: 0 }, - Trait => ident { name: 58, ctxt: 0 }, - Type => ident { name: 59, ctxt: 0 }, - Typeof => ident { name: 67, ctxt: 0 }, - Unsafe => ident { name: 60, ctxt: 0 }, - Use => ident { name: 61, ctxt: 0 }, - While => ident { name: 62, ctxt: 0 }, - Be => ident { name: 64, ctxt: 0 }, - Pure => ident { name: 65, ctxt: 0 }, - Yield => ident { name: 66, ctxt: 0 }, + As => Ident { name: 32, ctxt: 0 }, + Break => Ident { name: 33, ctxt: 0 }, + Const => Ident { name: 34, ctxt: 0 }, + Do => Ident { name: 35, ctxt: 0 }, + Else => Ident { name: 36, ctxt: 0 }, + Enum => Ident { name: 37, ctxt: 0 }, + Extern => Ident { name: 38, ctxt: 0 }, + False => Ident { name: 39, ctxt: 0 }, + Fn => Ident { name: 40, ctxt: 0 }, + For => Ident { name: 41, ctxt: 0 }, + If => Ident { name: 42, ctxt: 0 }, + Impl => Ident { name: 43, ctxt: 0 }, + In => Ident { name: 63, ctxt: 0 }, + Let => Ident { name: 44, ctxt: 0 }, + __Log => Ident { name: 45, ctxt: 0 }, + Loop => Ident { name: 46, ctxt: 0 }, + Match => Ident { name: 47, ctxt: 0 }, + Mod => Ident { name: 48, ctxt: 0 }, + Mut => Ident { name: 49, ctxt: 0 }, + Once => Ident { name: 50, ctxt: 0 }, + Priv => Ident { name: 51, ctxt: 0 }, + Pub => Ident { name: 52, ctxt: 0 }, + Ref => Ident { name: 53, ctxt: 0 }, + Return => Ident { name: 54, ctxt: 0 }, + Static => Ident { name: 27, ctxt: 0 }, + Self => Ident { name: 8, ctxt: 0 }, + Struct => Ident { name: 55, ctxt: 0 }, + Super => Ident { name: 56, ctxt: 0 }, + True => Ident { name: 57, ctxt: 0 }, + Trait => Ident { name: 58, ctxt: 0 }, + Type => Ident { name: 59, ctxt: 0 }, + Typeof => Ident { name: 67, ctxt: 0 }, + Unsafe => Ident { name: 60, ctxt: 0 }, + Use => Ident { name: 61, ctxt: 0 }, + While => Ident { name: 62, ctxt: 0 }, + Be => Ident { name: 64, ctxt: 0 }, + Pure => Ident { name: 65, ctxt: 0 }, + Yield => Ident { name: 66, ctxt: 0 }, } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 599092f4b1492..c03bcca7bf9e8 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -185,7 +185,7 @@ pub fn path_to_str(p: &ast::Path, intr: @ident_interner) -> ~str { to_str(p, |a,b| print_path(a, b, false), intr) } -pub fn fun_to_str(decl: &ast::fn_decl, purity: ast::purity, name: ast::ident, +pub fn fun_to_str(decl: &ast::fn_decl, purity: ast::purity, name: ast::Ident, opt_explicit_self: Option, generics: &ast::Generics, intr: @ident_interner) -> ~str { do io::with_str_writer |wr| { @@ -639,7 +639,7 @@ fn print_trait_ref(s: @ps, t: &ast::trait_ref) { } pub fn print_enum_def(s: @ps, enum_definition: &ast::enum_def, - generics: &ast::Generics, ident: ast::ident, + generics: &ast::Generics, ident: ast::Ident, span: codemap::Span, visibility: ast::visibility) { head(s, visibility_qualified(visibility, "enum")); print_ident(s, ident); @@ -691,7 +691,7 @@ pub fn print_visibility(s: @ps, vis: ast::visibility) { pub fn print_struct(s: @ps, struct_def: &ast::struct_def, generics: &ast::Generics, - ident: ast::ident, + ident: ast::Ident, span: codemap::Span) { print_ident(s, ident); print_generics(s, generics); @@ -1495,7 +1495,7 @@ pub fn print_decl(s: @ps, decl: &ast::decl) { } } -pub fn print_ident(s: @ps, ident: ast::ident) { +pub fn print_ident(s: @ps, ident: ast::Ident) { word(s.s, ident_to_str(&ident)); } @@ -1698,7 +1698,7 @@ pub fn print_fn(s: @ps, decl: &ast::fn_decl, purity: Option, abis: AbiSet, - name: ast::ident, + name: ast::Ident, generics: &ast::Generics, opt_explicit_self: Option, vis: ast::visibility) { @@ -1946,7 +1946,7 @@ pub fn print_ty_fn(s: @ps, purity: ast::purity, onceness: ast::Onceness, decl: &ast::fn_decl, - id: Option, + id: Option, opt_bounds: &Option>, generics: Option<&ast::Generics>, opt_explicit_self: Option) { diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 9d286f1759eff..a421d44e2e36d 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -82,7 +82,7 @@ pub fn string_to_pat(source_str : @str) -> @ast::pat { } // convert a vector of strings to a vector of ast::idents -pub fn strs_to_idents(ids: ~[&str]) -> ~[ast::ident] { +pub fn strs_to_idents(ids: ~[&str]) -> ~[ast::Ident] { ids.map(|u| token::str_to_ident(*u)) } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 0656ed1372d7b..6ccaece27b981 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -30,10 +30,10 @@ use opt_vec::OptVec; pub enum fn_kind<'self> { // fn foo() or extern "Abi" fn foo() - fk_item_fn(ident, &'self Generics, purity, AbiSet), + fk_item_fn(Ident, &'self Generics, purity, AbiSet), // fn foo(&self) - fk_method(ident, &'self Generics, &'self method), + fk_method(Ident, &'self Generics, &'self method), // @fn(x, y) { ... } fk_anon(ast::Sigil), @@ -42,7 +42,7 @@ pub enum fn_kind<'self> { fk_fn_block, } -pub fn name_of_fn(fk: &fn_kind) -> ident { +pub fn name_of_fn(fk: &fn_kind) -> Ident { match *fk { fk_item_fn(name, _, _, _) | fk_method(name, _, _) => { name @@ -86,7 +86,7 @@ pub trait Visitor { } fn visit_ty_method(&mut self, t:&TypeMethod, e:E) { walk_ty_method(self, t, e) } fn visit_trait_method(&mut self, t:&trait_method, e:E) { walk_trait_method(self, t, e) } - fn visit_struct_def(&mut self, s:@struct_def, i:ident, g:&Generics, n:NodeId, e:E) { + fn visit_struct_def(&mut self, s:@struct_def, i:Ident, g:&Generics, n:NodeId, e:E) { walk_struct_def(self, s, i, g, n, e) } fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) } @@ -144,7 +144,7 @@ impl Visitor for @mut Visitor { fn visit_trait_method(&mut self, a:&trait_method, e:E) { (*self).visit_trait_method(a, e) } - fn visit_struct_def(&mut self, a:@struct_def, b:ident, c:&Generics, d:NodeId, e:E) { + fn visit_struct_def(&mut self, a:@struct_def, b:Ident, c:&Generics, d:NodeId, e:E) { (*self).visit_struct_def(a, b, c, d, e) } fn visit_struct_field(&mut self, a:@struct_field, e:E) { @@ -476,7 +476,7 @@ pub fn walk_trait_method>(visitor: &mut V, pub fn walk_struct_def>(visitor: &mut V, struct_definition: @struct_def, - _: ast::ident, + _: ast::Ident, _: &Generics, _: NodeId, env: E) { @@ -693,7 +693,7 @@ pub trait SimpleVisitor { fn visit_fn(&mut self, &fn_kind, &fn_decl, &Block, Span, NodeId); fn visit_ty_method(&mut self, &TypeMethod); fn visit_trait_method(&mut self, &trait_method); - fn visit_struct_def(&mut self, @struct_def, ident, &Generics, NodeId); + fn visit_struct_def(&mut self, @struct_def, Ident, &Generics, NodeId); fn visit_struct_field(&mut self, @struct_field); fn visit_struct_method(&mut self, @method); } @@ -792,7 +792,7 @@ impl Visitor<()> for SimpleVisitorVisitor { } fn visit_struct_def(&mut self, struct_definition: @struct_def, - identifier: ident, + identifier: Ident, generics: &Generics, node_id: NodeId, env: ()) {