diff --git a/src/librustc/front/core_inject.rs b/src/librustc/front/core_inject.rs index a7c015d29a18..387cc9f80a7f 100644 --- a/src/librustc/front/core_inject.rs +++ b/src/librustc/front/core_inject.rs @@ -77,7 +77,7 @@ fn inject_libcore_ref(sess: Session, fold_mod: |module, fld| { let n2 = sess.next_node_id(); - let prelude_path = @ast::path { + let prelude_path = @ast::Path { span: dummy_sp(), global: false, idents: ~[ diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 139ffbb5f5bb..0cb1fdf91829 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -336,16 +336,16 @@ fn nospan(t: T) -> codemap::spanned { codemap::spanned { node: t, span: dummy_sp() } } -fn path_node(+ids: ~[ast::ident]) -> @ast::path { - @ast::path { span: dummy_sp(), +fn path_node(+ids: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: dummy_sp(), global: false, idents: ids, rp: None, types: ~[] } } -fn path_node_global(+ids: ~[ast::ident]) -> @ast::path { - @ast::path { span: dummy_sp(), +fn path_node_global(+ids: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: dummy_sp(), global: true, idents: ids, rp: None, diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 867fe0cd816c..72391b7aec2a 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -137,7 +137,7 @@ pub fn parse_arg_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt, parse_arg(st, conv) } -fn parse_path(st: @mut PState) -> @ast::path { +fn parse_path(st: @mut PState) -> @ast::Path { let mut idents: ~[ast::ident] = ~[]; fn is_last(c: char) -> bool { return c == '(' || c == ':'; } idents.push(parse_ident_(st, is_last)); @@ -146,7 +146,7 @@ fn parse_path(st: @mut PState) -> @ast::path { ':' => { next(st); next(st); } c => { if c == '(' { - return @ast::path { span: dummy_sp(), + return @ast::Path { span: dummy_sp(), global: false, idents: idents, rp: None, diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs index 2e2048b7ae4c..df0e508398ee 100644 --- a/src/librustc/middle/pat_util.rs +++ b/src/librustc/middle/pat_util.rs @@ -72,7 +72,7 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @pat) -> bool { } pub fn pat_bindings(dm: resolve::DefMap, pat: @pat, - it: &fn(binding_mode, node_id, span, @path)) { + it: &fn(binding_mode, node_id, span, @Path)) { do walk_pat(pat) |p| { match p.node { pat_ident(binding_mode, pth, _) if pat_is_binding(dm, p) => { diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 50e8ed23446d..e59ca9e65812 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -26,7 +26,7 @@ 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::{item_foreign_mod, item_fn, item_impl, item_struct}; -use syntax::ast::{item_trait, local_crate, node_id, pat_struct, path}; +use syntax::ast::{item_trait, local_crate, node_id, pat_struct, Path}; use syntax::ast::{private, provided, public, required, stmt_decl, visibility}; use syntax::ast; use syntax::ast_map::{node_foreign_item, node_item, node_method}; @@ -276,7 +276,7 @@ pub fn check_crate(tcx: ty::ctxt, }; // Checks that a private path is in scope. - let check_path: @fn(span: span, def: def, path: @path) = + let check_path: @fn(span: span, def: def, path: @Path) = |span, def, path| { debug!("checking path"); match def { diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index fcf0b7022a7a..1c4a1c456479 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -48,7 +48,7 @@ use syntax::ast::{item_const, item_enum, item_fn, item_foreign_mod}; use syntax::ast::{item_impl, item_mac, item_mod, item_trait, item_ty, le}; use syntax::ast::{local, local_crate, lt, method, mode, mul}; use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident}; -use syntax::ast::{path, pat_lit, pat_range, pat_struct}; +use syntax::ast::{Path, pat_lit, pat_range, pat_struct}; use syntax::ast::{prim_ty, private, provided}; use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl}; use syntax::ast::{struct_dtor, struct_field, struct_variant_kind}; @@ -4368,7 +4368,7 @@ pub impl Resolver { /// If `check_ribs` is true, checks the local definitions first; i.e. /// doesn't skip straight to the containing module. fn resolve_path(@mut self, - path: @path, + path: @Path, namespace: Namespace, check_ribs: bool, visitor: ResolveVisitor) @@ -4493,7 +4493,7 @@ pub impl Resolver { return NoNameDefinition; } - fn intern_module_part_of_path(@mut self, path: @path) -> ~[ident] { + fn intern_module_part_of_path(@mut self, path: @Path) -> ~[ident] { let mut module_path_idents = ~[]; for path.idents.eachi |index, ident| { if index == path.idents.len() - 1 { @@ -4507,7 +4507,7 @@ pub impl Resolver { } fn resolve_module_relative_path(@mut self, - path: @path, + path: @Path, +xray: XrayFlag, namespace: Namespace) -> Option { @@ -4553,7 +4553,7 @@ pub impl Resolver { /// Invariant: This must be called only during main resolution, not during /// import resolution. fn resolve_crate_relative_path(@mut self, - path: @path, + path: @Path, +xray: XrayFlag, namespace: Namespace) -> Option { diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index bfc9d646dbb6..a0c12ff1a204 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -136,7 +136,7 @@ fn ast_path_substs( def_id: ast::def_id, decl_generics: &ty::Generics, self_ty: Option, - path: @ast::path) -> ty::substs + path: @ast::Path) -> ty::substs { /*! * @@ -188,7 +188,7 @@ pub fn ast_path_to_substs_and_ty( self: &AC, rscope: &RS, did: ast::def_id, - path: @ast::path) -> ty_param_substs_and_ty + path: @ast::Path) -> ty_param_substs_and_ty { let tcx = self.tcx(); let ty::ty_param_bounds_and_ty { @@ -206,7 +206,7 @@ pub fn ast_path_to_trait_ref( rscope: &RS, trait_def_id: ast::def_id, self_ty: Option, - path: @ast::path) -> @ty::TraitRef + path: @ast::Path) -> @ty::TraitRef { let trait_def = self.get_trait_def(trait_def_id); @@ -229,7 +229,7 @@ pub fn ast_path_to_ty( self: &AC, rscope: &RS, did: ast::def_id, - path: @ast::path) + path: @ast::Path) -> ty_param_substs_and_ty { // Look up the polytype of the item and then substitute the provided types @@ -318,7 +318,7 @@ pub fn ast_ty_to_ty( } fn check_path_args(tcx: ty::ctxt, - path: @ast::path, + path: @ast::Path, flags: uint) { if (flags & NO_TPS) != 0u { if path.types.len() > 0u { diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index aa2414eac624..e2dd0d1ed9ed 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -99,7 +99,7 @@ pub struct pat_ctxt { block_region: ty::Region, // Region for the block of the arm } -pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path, +pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::Path, subpats: &Option<~[@ast::pat]>, expected: ty::t) { // Typecheck the path. @@ -234,7 +234,7 @@ pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path, /// `etc` is true if the pattern said '...' and false otherwise. pub fn check_struct_pat_fields(pcx: pat_ctxt, span: span, - path: @ast::path, + path: @ast::Path, fields: &[ast::field_pat], class_fields: ~[ty::field_ty], class_id: ast::def_id, @@ -285,7 +285,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt, } pub fn check_struct_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span, - expected: ty::t, path: @ast::path, + expected: ty::t, path: @ast::Path, fields: &[ast::field_pat], etc: bool, class_id: ast::def_id, substitutions: &ty::substs) { let fcx = pcx.fcx; @@ -326,7 +326,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span, expected: ty::t, - path: @ast::path, + path: @ast::Path, fields: &[ast::field_pat], etc: bool, enum_id: ast::def_id, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 245520190744..0eb2e5387c3b 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -3211,7 +3211,7 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt, // Instantiates the given path, which must refer to an item with the given // number of type parameters and type. pub fn instantiate_path(fcx: @mut FnCtxt, - pth: @ast::path, + pth: @ast::Path, tpt: ty_param_bounds_and_ty, span: span, node_id: ast::node_id, diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index ec77b54a8537..4add371a36f8 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -113,7 +113,7 @@ pub struct Lifetime { #[auto_encode] #[auto_decode] #[deriving(Eq)] -pub struct path { +pub struct Path { span: span, global: bool, idents: ~[ident], @@ -301,10 +301,10 @@ pub enum pat_ { // which it is. The resolver determines this, and // records this pattern's node_id in an auxiliary // set (of "pat_idents that refer to nullary enums") - pat_ident(binding_mode, @path, Option<@pat>), - pat_enum(@path, Option<~[@pat]>), /* "none" means a * pattern where + pat_ident(binding_mode, @Path, Option<@pat>), + pat_enum(@Path, Option<~[@pat]>), /* "none" means a * pattern where * we don't bind the fields to names */ - pat_struct(@path, ~[field_pat], bool), + pat_struct(@Path, ~[field_pat], bool), pat_tup(~[@pat]), pat_box(@pat), pat_uniq(@pat), @@ -567,7 +567,7 @@ pub enum expr_ { expr_assign_op(binop, @expr, @expr), expr_field(@expr, ident, ~[@Ty]), expr_index(@expr, @expr), - expr_path(@path), + expr_path(@Path), expr_addr_of(mutability, @expr), expr_break(Option), expr_again(Option), @@ -579,7 +579,7 @@ pub enum expr_ { expr_mac(mac), // A struct literal expression. - expr_struct(@path, ~[field], Option<@expr>), + expr_struct(@Path, ~[field], Option<@expr>), // A vector literal constructed from one repeated element. expr_repeat(@expr /* element */, @expr /* count */, mutability), @@ -697,7 +697,7 @@ pub type mac = spanned; #[auto_decode] #[deriving(Eq)] pub enum mac_ { - mac_invoc_tt(@path,~[token_tree]), // new macro-invocation + mac_invoc_tt(@Path,~[token_tree]), // new macro-invocation } pub type lit = spanned; @@ -894,7 +894,7 @@ pub enum ty_ { ty_closure(@TyClosure), ty_bare_fn(@TyBareFn), ty_tup(~[@Ty]), - ty_path(@path, node_id), + ty_path(@Path, node_id), ty_mac(mac), // ty_infer means the type should be inferred instead of it having been // specified. This should only appear at the "top level" of a type and not @@ -1118,13 +1118,13 @@ pub enum view_path_ { // or just // // foo::bar::baz (with 'baz =' implicitly on the left) - view_path_simple(ident, @path, namespace, node_id), + view_path_simple(ident, @Path, namespace, node_id), // foo::bar::* - view_path_glob(@path, node_id), + view_path_glob(@Path, node_id), // foo::bar::{a,b,c} - view_path_list(@path, ~[path_list_ident], node_id) + view_path_list(@Path, ~[path_list_ident], node_id) } #[auto_encode] @@ -1177,7 +1177,7 @@ pub struct attribute_ { #[auto_decode] #[deriving(Eq)] pub struct trait_ref { - path: @path, + path: @Path, ref_id: node_id, } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index c7227fa17687..e83a3ef8bad5 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -30,7 +30,7 @@ pub fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str { } -pub fn path_to_ident(p: @path) -> ident { copy *p.idents.last() } +pub fn path_to_ident(p: @Path) -> ident { copy *p.idents.last() } pub fn local_def(id: node_id) -> def_id { ast::def_id { crate: local_crate, node: id } @@ -223,8 +223,8 @@ pub fn default_block( } } -pub fn ident_to_path(s: span, +i: ident) -> @path { - @ast::path { span: s, +pub fn ident_to_path(s: span, +i: ident) -> @Path { + @ast::Path { span: s, global: false, idents: ~[i], rp: None, diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 97bc89248acf..f9dadb560e3d 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -224,7 +224,7 @@ priv impl @ext_ctxt { &self, _span: span, ident: ast::ident, - path: @ast::path, + path: @ast::Path, bounds: @OptVec ) -> ast::TyParam { let bound = ast::TraitTyParamBound(@ast::trait_ref { @@ -248,8 +248,8 @@ priv impl @ext_ctxt { } } - fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::path { - @ast::path { + fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: span, global: false, idents: strs, @@ -258,8 +258,8 @@ priv impl @ext_ctxt { } } - fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::path { - @ast::path { + fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: span, global: true, idents: strs, @@ -273,8 +273,8 @@ priv impl @ext_ctxt { span: span, +strs: ~[ast::ident], +tps: ~[@ast::Ty] - ) -> @ast::path { - @ast::path { + ) -> @ast::Path { + @ast::Path { span: span, global: false, idents: strs, @@ -288,8 +288,8 @@ priv impl @ext_ctxt { span: span, +strs: ~[ast::ident], +tps: ~[@ast::Ty] - ) -> @ast::path { - @ast::path { + ) -> @ast::Path { + @ast::Path { span: span, global: true, idents: strs, @@ -439,7 +439,7 @@ fn mk_impl( span: span, ident: ast::ident, ty_param: ast::TyParam, - path: @ast::path, + path: @ast::Path, generics: &ast::Generics, f: &fn(@ast::Ty) -> @ast::method ) -> @ast::item { diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 43f0c9edcb96..0f84ac415327 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -63,8 +63,8 @@ pub fn mk_unary(cx: @ext_ctxt, sp: span, op: ast::unop, e: @ast::expr) cx.next_id(); // see ast_util::op_expr_callee_id mk_expr(cx, sp, ast::expr_unary(op, e)) } -pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::path { - let p = @ast::path { span: sp, +pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::Path { + let p = @ast::Path { span: sp, global: false, idents: idents, rp: None, @@ -74,15 +74,15 @@ pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::path { pub fn mk_raw_path_(sp: span, +idents: ~[ast::ident], +types: ~[@ast::Ty]) - -> @ast::path { - @ast::path { span: sp, + -> @ast::Path { + @ast::Path { span: sp, global: false, idents: idents, rp: None, types: types } } -pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::path { - @ast::path { span: sp, +pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: sp, global: true, idents: idents, rp: None, @@ -295,7 +295,7 @@ pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt, } pub fn mk_pat_enum(cx: @ext_ctxt, span: span, - path: @ast::path, + path: @ast::Path, +subpats: ~[@ast::pat]) -> @ast::pat { let pat = ast::pat_enum(path, Some(subpats)); @@ -303,7 +303,7 @@ pub fn mk_pat_enum(cx: @ext_ctxt, } pub fn mk_pat_struct(cx: @ext_ctxt, span: span, - path: @ast::path, + path: @ast::Path, +field_pats: ~[ast::field_pat]) -> @ast::pat { let pat = ast::pat_struct(path, field_pats, false); diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 0c3bef56459b..f4901191b8ac 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -41,7 +41,7 @@ pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree]) id: cx.next_id(), callee_id: cx.next_id(), node: ast::expr_path( - @ast::path { + @ast::Path { span: sp, global: false, idents: ~[res], diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index ccd9a33757dd..4337546930ff 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -185,7 +185,7 @@ pub fn create_derived_impl(cx: @ext_ctxt, }); // Create the reference to the trait. - let trait_path = ast::path { + let trait_path = ast::Path { span: span, global: true, idents: trait_path.map(|x| *x), diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 1d1a101d61f1..5eea58b89b1c 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -34,16 +34,16 @@ mod syntax { pub use parse; } -pub fn path(+ids: ~[ident], span: span) -> @ast::path { - @ast::path { span: span, +pub fn path(+ids: ~[ident], span: span) -> @ast::Path { + @ast::Path { span: span, global: false, idents: ids, rp: None, types: ~[] } } -pub fn path_global(+ids: ~[ident], span: span) -> @ast::path { - @ast::path { span: span, +pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path { + @ast::Path { span: span, global: true, idents: ids, rp: None, @@ -51,20 +51,20 @@ pub fn path_global(+ids: ~[ident], span: span) -> @ast::path { } pub trait append_types { - fn add_ty(&self, ty: @ast::Ty) -> @ast::path; - fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::path; + fn add_ty(&self, ty: @ast::Ty) -> @ast::Path; + fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path; } -impl append_types for @ast::path { - fn add_ty(&self, ty: @ast::Ty) -> @ast::path { - @ast::path { +impl append_types for @ast::Path { + fn add_ty(&self, ty: @ast::Ty) -> @ast::Path { + @ast::Path { types: vec::append_one(copy self.types, ty), .. copy **self } } - fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::path { - @ast::path { + fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path { + @ast::Path { types: vec::append(copy self.types, tys), .. copy **self } @@ -108,7 +108,7 @@ pub trait ext_ctxt_ast_builder { span: span, +struct_def: ast::struct_def) -> @ast::item; fn struct_expr(&self, - path: @ast::path, + path: @ast::Path, +fields: ~[ast::field]) -> @ast::expr; fn variant(&self, name: ident, @@ -118,7 +118,7 @@ pub trait ext_ctxt_ast_builder { name: ident, span: span, +items: ~[@ast::item]) -> @ast::item; - fn ty_path_ast_builder(&self, path: @ast::path) -> @ast::Ty; + fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty; fn item_ty_poly(&self, name: ident, span: span, @@ -328,7 +328,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { self.item(name, span, ast::item_struct(@struct_def, generics)) } - fn struct_expr(&self, path: @ast::path, + fn struct_expr(&self, path: @ast::Path, +fields: ~[ast::field]) -> @ast::expr { @ast::expr { id: self.next_id(), @@ -397,7 +397,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { ) } - fn ty_path_ast_builder(&self, path: @ast::path) -> @ast::Ty { + fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty { @ast::Ty { id: self.next_id(), node: ast::ty_path(path, self.next_id()), diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 5aa51c262e17..768dba214125 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -36,7 +36,7 @@ pub trait ast_fold { fn fold_foreign_mod(@self, &foreign_mod) -> foreign_mod; fn fold_variant(@self, &variant) -> variant; fn fold_ident(@self, ident) -> ident; - fn fold_path(@self, @path) -> @path; + fn fold_path(@self, @Path) -> @Path; fn fold_local(@self, @local) -> @local; fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr]; fn new_id(@self, node_id) -> node_id; @@ -65,7 +65,7 @@ pub struct AstFoldFns { 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_path: @fn(@path, @ast_fold) -> path, + fold_path: @fn(@Path, @ast_fold) -> Path, fold_local: @fn(&local_, span, @ast_fold) -> (local_, span), map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr], new_id: @fn(node_id) -> node_id, @@ -702,8 +702,8 @@ fn noop_fold_ident(i: ident, _fld: @ast_fold) -> ident { /* FIXME (#2543) */ copy i } -fn noop_fold_path(p: @path, fld: @ast_fold) -> path { - ast::path { +fn noop_fold_path(p: @Path, fld: @ast_fold) -> Path { + ast::Path { span: fld.new_span(p.span), global: p.global, idents: p.idents.map(|x| fld.fold_ident(*x)), @@ -851,7 +851,7 @@ impl ast_fold for AstFoldFns { fn fold_ident(@self, x: ident) -> ident { (self.fold_ident)(x, self as @ast_fold) } - fn fold_path(@self, x: @path) -> @path { + fn fold_path(@self, x: @Path) -> @Path { @(self.fold_path)(x, self as @ast_fold) } fn fold_local(@self, x: @local) -> @local { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3a3597828cd2..ca6fab62e292 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -897,7 +897,7 @@ pub impl Parser { // parse a path that doesn't have type parameters attached fn parse_path_without_tps(&self) - -> @ast::path { + -> @ast::Path { maybe_whole!(self, nt_path); let lo = self.span.lo; let global = self.eat(&token::MOD_SEP); @@ -917,7 +917,7 @@ pub impl Parser { break; } } - @ast::path { span: mk_sp(lo, self.last_span.hi), + @ast::Path { span: mk_sp(lo, self.last_span.hi), global: global, idents: ids, rp: None, @@ -927,7 +927,7 @@ pub impl Parser { // parse a path optionally with type parameters. If 'colons' // is true, then type parameters must be preceded by colons, // as in a::t:: - fn parse_path_with_tps(&self, colons: bool) -> @ast::path { + fn parse_path_with_tps(&self, colons: bool) -> @ast::Path { debug!("parse_path_with_tps(colons=%b)", colons); maybe_whole!(self, nt_path); @@ -982,7 +982,7 @@ pub impl Parser { } }; - @ast::path { span: mk_sp(lo, hi), + @ast::Path { span: mk_sp(lo, hi), rp: rp, types: tps, .. copy *path } @@ -4215,7 +4215,7 @@ pub impl Parser { let id = self.parse_ident(); path.push(id); } - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, @@ -4244,7 +4244,7 @@ pub impl Parser { seq_sep_trailing_allowed(token::COMMA), |p| p.parse_path_list_ident() ); - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, @@ -4256,7 +4256,7 @@ pub impl Parser { // foo::bar::* token::BINOP(token::STAR) => { self.bump(); - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, @@ -4272,7 +4272,7 @@ pub impl Parser { _ => () } let last = path[vec::len(path) - 1u]; - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 713a6e894755..54b2ad851478 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -113,7 +113,7 @@ pub enum nonterminal { nt_expr(@ast::expr), nt_ty( @ast::Ty), nt_ident(ast::ident, bool), - nt_path(@ast::path), + nt_path(@ast::Path), nt_tt( @ast::token_tree), //needs @ed to break a circularity nt_matchers(~[ast::matcher]) } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 20fc99baf217..fa1b97275660 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -178,7 +178,7 @@ pub fn generics_to_str(generics: &ast::Generics, to_str(generics, print_generics, intr) } -pub fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str { +pub fn path_to_str(&&p: @ast::Path, intr: @ident_interner) -> ~str { to_str(p, |a,b| print_path(a, b, false), intr) } @@ -1486,7 +1486,7 @@ pub fn print_for_decl(s: @ps, loc: @ast::local, coll: @ast::expr) { print_expr(s, coll); } -pub fn print_path(s: @ps, &&path: @ast::path, colons_before_params: bool) { +pub fn print_path(s: @ps, &&path: @ast::Path, colons_before_params: bool) { maybe_print_comment(s, path.span.lo); if path.global { word(s.s, ~"::"); } let mut first = true; diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index b20c5eeee1f0..c4c187bc4c7c 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -265,7 +265,7 @@ pub fn visit_ty(t: @Ty, e: E, v: vt) { } } -pub fn visit_path(p: @path, e: E, v: vt) { +pub fn visit_path(p: @Path, e: E, v: vt) { for p.types.each |tp| { (v.visit_ty)(*tp, e, v); } }