diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic.rs | 54 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 32 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/opt_vec.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 6 |
11 files changed, 82 insertions, 81 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 11a55a4adbc..afbbb069354 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -390,13 +390,13 @@ pub trait IdVisitingOperation { fn visit_id(&self, node_id: NodeId); } -pub struct IdVisitor<'self, O> { - operation: &'self O, +pub struct IdVisitor<'a, O> { + operation: &'a O, pass_through_items: bool, visited_outermost: bool, } -impl<'self, O: IdVisitingOperation> IdVisitor<'self, O> { +impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> { fn visit_generics_helper(&self, generics: &Generics) { for type_parameter in generics.ty_params.iter() { self.operation.visit_id(type_parameter.id) @@ -407,7 +407,7 @@ impl<'self, O: IdVisitingOperation> IdVisitor<'self, O> { } } -impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> { +impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> { fn visit_mod(&mut self, module: &_mod, _: Span, @@ -657,11 +657,11 @@ pub trait EachViewItem { fn each_view_item(&self, f: |&ast::view_item| -> bool) -> bool; } -struct EachViewItemData<'self> { - callback: 'self |&ast::view_item| -> bool, +struct EachViewItemData<'a> { + callback: 'a |&ast::view_item| -> bool, } -impl<'self> Visitor<()> for EachViewItemData<'self> { +impl<'a> Visitor<()> for EachViewItemData<'a> { fn visit_view_item(&mut self, view_item: &ast::view_item, _: ()) { let _ = (self.callback)(view_item); } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index af86091084a..d5a64a5edba 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -493,7 +493,7 @@ pub fn get_exprs_from_tts(cx: @ExtCtxt, // use a top-level managed pointer by some difficulties // with pushing and popping functionally, and the ownership // issues. As a result, the values returned by the table -// also need to be managed; the &'self ... type that Maps +// also need to be managed; the &'a ... type that Maps // return won't work for things that need to get outside // of that managed pointer. The easiest way to do this // is just to insist that the values in the tables are diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index fefc4a9bafb..b3e2503f8c4 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -188,41 +188,41 @@ use std::vec; pub use self::ty::*; mod ty; -pub struct TraitDef<'self> { +pub struct TraitDef<'a> { /// The extension context cx: @ExtCtxt, /// The span for the current #[deriving(Foo)] header. span: Span, /// Path of the trait, including any type parameters - path: Path<'self>, + path: Path<'a>, /// Additional bounds required of any type parameters of the type, /// other than the current trait - additional_bounds: ~[Ty<'self>], + additional_bounds: ~[Ty<'a>], /// Any extra lifetimes and/or bounds, e.g. `D: extra::serialize::Decoder` - generics: LifetimeBounds<'self>, + generics: LifetimeBounds<'a>, - methods: ~[MethodDef<'self>] + methods: ~[MethodDef<'a>] } -pub struct MethodDef<'self> { +pub struct MethodDef<'a> { /// name of the method - name: &'self str, + name: &'a str, /// List of generics, e.g. `R: std::rand::Rng` - generics: LifetimeBounds<'self>, + generics: LifetimeBounds<'a>, /// Whether there is a self argument (outer Option) i.e. whether /// this is a static function, and whether it is a pointer (inner /// Option) - explicit_self: Option<Option<PtrTy<'self>>>, + explicit_self: Option<Option<PtrTy<'a>>>, /// Arguments other than the self argument - args: ~[Ty<'self>], + args: ~[Ty<'a>], /// Return type - ret_ty: Ty<'self>, + ret_ty: Ty<'a>, /// Whether to mark this as #[inline] inline: bool, @@ -231,20 +231,20 @@ pub struct MethodDef<'self> { /// actual enum variants, i.e. can use _ => .. match. const_nonmatching: bool, - combine_substructure: CombineSubstructureFunc<'self> + combine_substructure: CombineSubstructureFunc<'a> } /// All the data about the data structure/method being derived upon. -pub struct Substructure<'self> { +pub struct Substructure<'a> { /// ident of self type_ident: Ident, /// ident of the method method_ident: Ident, /// dereferenced access to any Self or Ptr(Self, _) arguments - self_args: &'self [@Expr], + self_args: &'a [@Expr], /// verbatim access to any other arguments - nonself_args: &'self [@Expr], - fields: &'self SubstructureFields<'self> + nonself_args: &'a [@Expr], + fields: &'a SubstructureFields<'a> } /// Summary of the relevant parts of a struct/enum field. @@ -271,26 +271,26 @@ pub enum StaticFields { /// A summary of the possible sets of fields. See above for details /// and examples -pub enum SubstructureFields<'self> { +pub enum SubstructureFields<'a> { Struct(~[FieldInfo]), /** Matching variants of the enum: variant index, ast::variant, fields: the field name is only non-`None` in the case of a struct variant. */ - EnumMatching(uint, &'self ast::variant, ~[FieldInfo]), + EnumMatching(uint, &'a ast::variant, ~[FieldInfo]), /** non-matching variants of the enum, [(variant index, ast::variant, [field span, 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, P<ast::variant>, ~[(Span, Option<Ident>, @Expr)])]), + EnumNonMatching(&'a [(uint, P<ast::variant>, ~[(Span, Option<Ident>, @Expr)])]), /// A static method where Self is a struct. - StaticStruct(&'self ast::struct_def, StaticFields), + StaticStruct(&'a ast::struct_def, StaticFields), /// A static method where Self is an enum. - StaticEnum(&'self ast::enum_def, ~[(Ident, StaticFields)]) + StaticEnum(&'a ast::enum_def, ~[(Ident, StaticFields)]) } @@ -299,23 +299,23 @@ pub enum SubstructureFields<'self> { Combine the values of all the fields together. The last argument is all the fields of all the structures, see above for details. */ -pub type CombineSubstructureFunc<'self> = - 'self |@ExtCtxt, Span, &Substructure| -> @Expr; +pub type CombineSubstructureFunc<'a> = + 'a |@ExtCtxt, Span, &Substructure| -> @Expr; /** Deal with non-matching enum variants, the arguments are a list representing each variant: (variant index, ast::variant instance, [variant fields]), and a list of the nonself args of the type */ -pub type EnumNonMatchFunc<'self> = - 'self |@ExtCtxt, +pub type EnumNonMatchFunc<'a> = + 'a |@ExtCtxt, Span, &[(uint, P<ast::variant>, ~[(Span, Option<Ident>, @Expr)])], &[@Expr]| -> @Expr; -impl<'self> TraitDef<'self> { +impl<'a> TraitDef<'a> { pub fn expand(&self, _mitem: @ast::MetaItem, in_items: ~[@ast::item]) -> ~[@ast::item] { @@ -467,7 +467,7 @@ impl<'self> TraitDef<'self> { } } -impl<'self> MethodDef<'self> { +impl<'a> MethodDef<'a> { fn call_substructure_method(&self, trait_: &TraitDef, type_ident: Ident, diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 9c611d7e7b2..d38f9b4d1b7 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -46,13 +46,13 @@ pub mod totalord; pub mod generic; -pub type ExpandDerivingStructDefFn<'self> = 'self |@ExtCtxt, +pub type ExpandDerivingStructDefFn<'a> = 'a |@ExtCtxt, Span, x: &struct_def, Ident, y: &Generics| -> @item; -pub type ExpandDerivingEnumDefFn<'self> = 'self |@ExtCtxt, +pub type ExpandDerivingEnumDefFn<'a> = 'a |@ExtCtxt, Span, x: &enum_def, Ident, diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 87381d25dc7..e606cebc415 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -22,22 +22,22 @@ use opt_vec; use opt_vec::OptVec; /// The types of pointers -pub enum PtrTy<'self> { +pub enum PtrTy<'a> { Send, // ~ Managed(ast::Mutability), // @[mut] - Borrowed(Option<&'self str>, ast::Mutability), // &['lifetime] [mut] + Borrowed(Option<&'a str>, ast::Mutability), // &['lifetime] [mut] } /// A path, e.g. `::std::option::Option::<int>` (global). Has support /// for type parameters and a lifetime. -pub struct Path<'self> { - path: ~[&'self str], - lifetime: Option<&'self str>, - params: ~[~Ty<'self>], +pub struct Path<'a> { + path: ~[&'a str], + lifetime: Option<&'a str>, + params: ~[~Ty<'a>], global: bool } -impl<'self> Path<'self> { +impl<'a> Path<'a> { pub fn new<'r>(path: ~[&'r str]) -> Path<'r> { Path::new_(path, None, ~[], true) } @@ -80,15 +80,15 @@ impl<'self> Path<'self> { } /// A type. Supports pointers (except for *), Self, and literals -pub enum Ty<'self> { +pub enum Ty<'a> { Self, // &/~/@ Ty - Ptr(~Ty<'self>, PtrTy<'self>), + Ptr(~Ty<'a>, PtrTy<'a>), // mod::mod::Type<[lifetime], [Params...]>, including a plain type // parameter, and things like `int` - Literal(Path<'self>), + Literal(Path<'a>), // includes nil - Tuple(~[Ty<'self>]) + Tuple(~[Ty<'a>]) } pub fn borrowed_ptrty<'r>() -> PtrTy<'r> { @@ -124,7 +124,7 @@ fn mk_lifetimes(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> OptVec<ast::Life } } -impl<'self> Ty<'self> { +impl<'a> Ty<'a> { pub fn to_ty(&self, cx: @ExtCtxt, span: Span, @@ -207,12 +207,12 @@ fn mk_generics(lifetimes: ~[ast::Lifetime], ty_params: ~[ast::TyParam]) -> Gene } /// Lifetimes and bounds on type parameters -pub struct LifetimeBounds<'self> { - lifetimes: ~[&'self str], - bounds: ~[(&'self str, ~[Path<'self>])] +pub struct LifetimeBounds<'a> { + lifetimes: ~[&'a str], + bounds: ~[(&'a str, ~[Path<'a>])] } -impl<'self> LifetimeBounds<'self> { +impl<'a> LifetimeBounds<'a> { pub fn empty() -> LifetimeBounds<'static> { LifetimeBounds { lifetimes: ~[], bounds: ~[] diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 451e6683f0c..77cb02522a7 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -80,7 +80,7 @@ pub mod rt { } } - impl<'self> ToSource for &'self [@ast::item] { + impl<'a> ToSource for &'a [@ast::item] { fn to_source(&self) -> @str { self.map(|i| i.to_source()).connect("\n\n").to_managed() } @@ -92,7 +92,7 @@ pub mod rt { } } - impl<'self> ToSource for &'self [ast::Ty] { + impl<'a> ToSource for &'a [ast::Ty] { fn to_source(&self) -> @str { self.map(|i| i.to_source()).connect(", ").to_managed() } @@ -116,7 +116,7 @@ pub mod rt { } } - impl<'self> ToSource for &'self str { + impl<'a> ToSource for &'a str { fn to_source(&self) -> @str { let lit = dummy_spanned(ast::lit_str(self.to_managed(), ast::CookedStr)); pprust::lit_to_str(&lit).to_managed() @@ -208,7 +208,7 @@ pub mod rt { macro_rules! impl_to_tokens_self( ($t:ty) => ( - impl<'self> ToTokens for $t { + impl<'a> ToTokens for $t { fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] { cx.parse_tts(self.to_source()) } @@ -218,13 +218,13 @@ pub mod rt { impl_to_tokens!(ast::Ident) impl_to_tokens!(@ast::item) - impl_to_tokens_self!(&'self [@ast::item]) + impl_to_tokens_self!(&'a [@ast::item]) impl_to_tokens!(ast::Ty) - impl_to_tokens_self!(&'self [ast::Ty]) + impl_to_tokens_self!(&'a [ast::Ty]) impl_to_tokens!(Generics) impl_to_tokens!(@ast::Expr) impl_to_tokens!(ast::Block) - impl_to_tokens_self!(&'self str) + impl_to_tokens_self!(&'a str) impl_to_tokens!(int) impl_to_tokens!(i8) impl_to_tokens!(i16) diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 3a0b7c6adc4..247962e0b94 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -144,13 +144,13 @@ impl<T> Default for OptVec<T> { fn default() -> OptVec<T> { Empty } } -pub struct OptVecIterator<'self, T> { - priv iter: Option<VecIterator<'self, T>> +pub struct OptVecIterator<'a, T> { + priv iter: Option<VecIterator<'a, T>> } -impl<'self, T> Iterator<&'self T> for OptVecIterator<'self, T> { +impl<'a, T> Iterator<&'a T> for OptVecIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self T> { + fn next(&mut self) -> Option<&'a T> { match self.iter { Some(ref mut x) => x.next(), None => None diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 22a999ab744..d48c1d9d8d7 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -764,14 +764,15 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token { let ident = str_to_ident(lifetime_name); let tok = &token::IDENT(ident, false); - if token::is_any_keyword(tok) - && !token::is_keyword(token::keywords::Static, tok) - && !token::is_keyword(token::keywords::Self, tok) { + if token::is_keyword(token::keywords::Self, tok) { fatal_span(rdr, start, rdr.last_pos, - ~"invalid lifetime name"); + ~"invalid lifetime name: 'self is no longer a special lifetime"); + } else if token::is_any_keyword(tok) && + !token::is_keyword(token::keywords::Static, tok) { + fatal_span(rdr, start, rdr.last_pos, ~"invalid lifetime name"); + } else { + token::LIFETIME(ident) } - - token::LIFETIME(ident) }) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4270a4d0dc5..aa37d859d79 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -102,13 +102,13 @@ pub enum PathParsingMode { /// A path with no type parameters; e.g. `foo::bar::Baz` NoTypesAllowed, /// A path with a lifetime and type parameters, with no double colons - /// before the type parameters; e.g. `foo::bar<'self>::Baz<T>` + /// before the type parameters; e.g. `foo::bar<'a>::Baz<T>` LifetimeAndTypesWithoutColons, /// A path with a lifetime and type parameters with double colons before - /// the type parameters; e.g. `foo::bar::<'self>::Baz::<T>` + /// the type parameters; e.g. `foo::bar::<'a>::Baz::<T>` LifetimeAndTypesWithColons, /// A path with a lifetime and type parameters with bounds before the last - /// set of type parameters only; e.g. `foo::bar<'self>::Baz:X+Y<T>` This + /// set of type parameters only; e.g. `foo::bar<'a>::Baz:X+Y<T>` This /// form does not use extra double colons. LifetimeAndTypesAndBounds, } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 19133fad9ee..503d884c24d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -34,11 +34,11 @@ use std::io::Decorator; use std::io::mem::MemWriter; // The @ps is stored here to prevent recursive type. -pub enum ann_node<'self> { - node_block(@ps, &'self ast::Block), - node_item(@ps, &'self ast::item), - node_expr(@ps, &'self ast::Expr), - node_pat(@ps, &'self ast::Pat), +pub enum ann_node<'a> { + node_block(@ps, &'a ast::Block), + node_item(@ps, &'a ast::item), + node_expr(@ps, &'a ast::Expr), + node_pat(@ps, &'a ast::Pat), } pub trait pp_ann { diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index a5a8513fa71..3bfc88e1e81 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -28,12 +28,12 @@ use opt_vec::OptVec; // execute before AST node B, then A is visited first. The borrow checker in // particular relies on this property. -pub enum fn_kind<'self> { +pub enum fn_kind<'a> { // fn foo() or extern "Abi" fn foo() - fk_item_fn(Ident, &'self Generics, purity, AbiSet), + fk_item_fn(Ident, &'a Generics, purity, AbiSet), // fn foo(&self) - fk_method(Ident, &'self Generics, &'self method), + fk_method(Ident, &'a Generics, &'a method), // @fn(x, y) { ... } fk_anon(ast::Sigil), |
