From 189c0085d19c2cbd8e3b6ca8274e2cab60aad515 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 7 Mar 2014 03:10:52 +0100 Subject: [PATCH] alpha-rename .ident to .name in Lifetime, including in rustdoc. --- src/librustc/middle/resolve_lifetime.rs | 14 +++++++------- src/librustc/middle/typeck/astconv.rs | 6 +++--- src/librustc/middle/typeck/collect.rs | 2 +- src/librustc/util/ppaux.rs | 16 ++++++++-------- src/librustdoc/clean.rs | 2 +- src/libsyntax/ast.rs | 2 +- src/libsyntax/ext/build.rs | 4 ++-- src/libsyntax/fold.rs | 2 +- src/libsyntax/parse/mod.rs | 6 +++--- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/print/pprust.rs | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index c8e28d45e3c..784b0cdab3d 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -145,7 +145,7 @@ impl<'a> Visitor<&'a ScopeChain<'a>> for LifetimeContext { fn visit_lifetime_ref(&mut self, lifetime_ref: &ast::Lifetime, scope: &'a ScopeChain<'a>) { - if lifetime_ref.ident == special_idents::statik.name { + if lifetime_ref.name == special_idents::statik.name { self.insert_lifetime(lifetime_ref, ast::DefStaticRegion); return; } @@ -262,7 +262,7 @@ impl LifetimeContext { self.sess.span_err( lifetime_ref.span, format!("use of undeclared lifetime name `'{}`", - token::get_name(lifetime_ref.ident))); + token::get_name(lifetime_ref.name))); } fn check_lifetime_names(&self, lifetimes: &OptVec) { @@ -271,23 +271,23 @@ impl LifetimeContext { let special_idents = [special_idents::statik]; for lifetime in lifetimes.iter() { - if special_idents.iter().any(|&i| i.name == lifetime.ident) { + if special_idents.iter().any(|&i| i.name == lifetime.name) { self.sess.span_err( lifetime.span, format!("illegal lifetime parameter name: `{}`", - token::get_name(lifetime.ident))); + token::get_name(lifetime.name))); } } for j in range(i + 1, lifetimes.len()) { let lifetime_j = lifetimes.get(j); - if lifetime_i.ident == lifetime_j.ident { + if lifetime_i.name == lifetime_j.name { self.sess.span_err( lifetime_j.span, format!("lifetime name `'{}` declared twice in \ the same scope", - token::get_name(lifetime_j.ident))); + token::get_name(lifetime_j.name))); } } } @@ -315,7 +315,7 @@ fn search_lifetimes(lifetimes: &OptVec, lifetime_ref: &ast::Lifetime) -> Option<(uint, ast::NodeId)> { for (i, lifetime_decl) in lifetimes.iter().enumerate() { - if lifetime_decl.ident == lifetime_ref.ident { + if lifetime_decl.name == lifetime_ref.name { return Some((i, lifetime_decl.id)); } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 40e836ac0d9..085a8a4efeb 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -92,18 +92,18 @@ pub fn ast_region_to_region(tcx: ty::ctxt, lifetime: &ast::Lifetime) Some(&ast::DefLateBoundRegion(binder_id, _, id)) => { ty::ReLateBound(binder_id, ty::BrNamed(ast_util::local_def(id), - lifetime.ident)) + lifetime.name)) } Some(&ast::DefEarlyBoundRegion(index, id)) => { - ty::ReEarlyBound(id, index, lifetime.ident) + ty::ReEarlyBound(id, index, lifetime.name) } Some(&ast::DefFreeRegion(scope_id, id)) => { ty::ReFree(ty::FreeRegion { scope_id: scope_id, bound_region: ty::BrNamed(ast_util::local_def(id), - lifetime.ident) + lifetime.name) }) } }; diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 04f37c95b07..82246899fb7 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -966,7 +966,7 @@ pub fn ty_generics(ccx: &CrateCtxt, base_index: uint) -> ty::Generics { return ty::Generics { region_param_defs: Rc::new(generics.lifetimes.iter().map(|l| { - ty::RegionParameterDef { name: l.ident, + ty::RegionParameterDef { name: l.name, def_id: local_def(l.id) } }).collect()), type_param_defs: Rc::new(generics.ty_params.mapi_to_vec(|offset, param| { diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 83877e1710a..c6765bd305a 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -161,8 +161,8 @@ pub fn bound_region_to_str(cx: ctxt, } match br { - BrNamed(_, ident) => format!("{}'{}{}", prefix, - token::get_name(ident), space_str), + BrNamed(_, name) => format!("{}'{}{}", prefix, + token::get_name(name), space_str), BrAnon(_) => prefix.to_str(), BrFresh(_) => prefix.to_str(), } @@ -224,7 +224,7 @@ pub fn region_to_str(cx: ctxt, prefix: &str, space: bool, region: Region) -> ~st // `explain_region()` or `note_and_explain_region()`. match region { ty::ReScope(_) => prefix.to_str(), - ty::ReEarlyBound(_, _, ident) => token::get_name(ident).get().to_str(), + ty::ReEarlyBound(_, _, name) => token::get_name(name).get().to_str(), ty::ReLateBound(_, br) => bound_region_to_str(cx, prefix, space, br), ty::ReFree(ref fr) => bound_region_to_str(cx, prefix, space, fr.bound_region), ty::ReInfer(ReSkolemized(_, br)) => { @@ -720,9 +720,9 @@ impl Repr for ty::BoundRegion { fn repr(&self, tcx: ctxt) -> ~str { match *self { ty::BrAnon(id) => format!("BrAnon({})", id), - ty::BrNamed(id, ident) => format!("BrNamed({}, {})", - id.repr(tcx), - token::get_name(ident)), + ty::BrNamed(id, name) => format!("BrNamed({}, {})", + id.repr(tcx), + token::get_name(name)), ty::BrFresh(id) => format!("BrFresh({})", id), } } @@ -731,9 +731,9 @@ impl Repr for ty::BoundRegion { impl Repr for ty::Region { fn repr(&self, tcx: ctxt) -> ~str { match *self { - ty::ReEarlyBound(id, index, ident) => { + ty::ReEarlyBound(id, index, name) => { format!("ReEarlyBound({}, {}, {})", - id, index, token::get_name(ident)) + id, index, token::get_name(name)) } ty::ReLateBound(binder_id, ref bound_region) => { diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index f26977e211c..625cc5bc623 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -333,7 +333,7 @@ impl Lifetime { impl Clean for ast::Lifetime { fn clean(&self) -> Lifetime { - Lifetime(token::get_name(self.ident).get().to_owned()) + Lifetime(token::get_name(self.name).get().to_owned()) } } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 0a959993517..372641af5f8 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -118,7 +118,7 @@ pub type FnIdent = Option; pub struct Lifetime { id: NodeId, span: Span, - ident: Name + name: Name } // a "Path" is essentially Rust's notion of a name; diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 8296ee34c54..e644eca8f7d 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -413,8 +413,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::TraitTyParamBound(self.trait_ref(path)) } - fn lifetime(&self, span: Span, ident: ast::Name) -> ast::Lifetime { - ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, ident: ident } + fn lifetime(&self, span: Span, name: ast::Name) -> ast::Lifetime { + ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, name: name } } fn stmt_expr(&self, expr: @ast::Expr) -> @ast::Stmt { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index df6b06c5804..99e7b6a7ab1 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -435,7 +435,7 @@ pub fn fold_lifetime(l: &Lifetime, fld: &mut T) -> Lifetime { Lifetime { id: fld.new_id(l.id), span: fld.new_span(l.span), - ident: l.ident + name: l.name } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 9e5db1770bf..b6f813269cf 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -323,7 +323,7 @@ mod test { segments: vec!( ast::PathSegment { identifier: str_to_ident("a"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -342,12 +342,12 @@ mod test { segments: vec!( ast::PathSegment { identifier: str_to_ident("a"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }, ast::PathSegment { identifier: str_to_ident("b"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c8bd87024e8..f80fc78b79c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1609,7 +1609,7 @@ impl Parser { return ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, - ident: i.name + name: i.name }; } _ => { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index aafda9d687d..45ab4c6956a 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1956,7 +1956,7 @@ pub fn print_bounds(s: &mut State, bounds: &OptVec, pub fn print_lifetime(s: &mut State, lifetime: &ast::Lifetime) -> io::IoResult<()> { try!(word(&mut s.s, "'")); - print_name(s, lifetime.ident) + print_name(s, lifetime.name) } pub fn print_generics(s: &mut State,