about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorJames Miller <bladeon@gmail.com>2013-07-06 00:33:52 +1200
committerJames Miller <bladeon@gmail.com>2013-07-07 22:51:09 +1200
commit62c83bb17be9a47799d702a9470aa7a84012c782 (patch)
treee3abca4816806c45787d44c209b144fa068b58b8 /src/libsyntax
parentcd1b6c897911c91167c5a3c5e3c2fa0d9334ad45 (diff)
downloadrust-62c83bb17be9a47799d702a9470aa7a84012c782.tar.gz
rust-62c83bb17be9a47799d702a9470aa7a84012c782.zip
De-manage Lifetime
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs10
-rw-r--r--src/libsyntax/ext/build.rs8
-rw-r--r--src/libsyntax/ext/deriving/generic.rs2
-rw-r--r--src/libsyntax/ext/deriving/ty.rs9
-rw-r--r--src/libsyntax/parse/parser.rs20
-rw-r--r--src/libsyntax/print/pprust.rs20
6 files changed, 34 insertions, 35 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index d053c203b91..9c3111a6918 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -109,7 +109,7 @@ pub struct Path {
     span: span,
     global: bool,
     idents: ~[ident],
-    rp: Option<@Lifetime>,
+    rp: Option<Lifetime>,
     types: ~[@Ty],
 }
 
@@ -296,7 +296,7 @@ pub enum vstore {
     vstore_fixed(Option<uint>),     // [1,2,3,4]
     vstore_uniq,                    // ~[1,2,3,4]
     vstore_box,                     // @[1,2,3,4]
-    vstore_slice(Option<@Lifetime>) // &'foo? [1,2,3,4]
+    vstore_slice(Option<Lifetime>) // &'foo? [1,2,3,4]
 }
 
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
@@ -701,7 +701,7 @@ impl ToStr for Onceness {
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub struct TyClosure {
     sigil: Sigil,
-    region: Option<@Lifetime>,
+    region: Option<Lifetime>,
     lifetimes: OptVec<Lifetime>,
     purity: purity,
     onceness: Onceness,
@@ -730,7 +730,7 @@ pub enum ty_ {
     ty_vec(mt),
     ty_fixed_length_vec(mt, @expr),
     ty_ptr(mt),
-    ty_rptr(Option<@Lifetime>, mt),
+    ty_rptr(Option<Lifetime>, mt),
     ty_closure(@TyClosure),
     ty_bare_fn(@TyBareFn),
     ty_tup(~[@Ty]),
@@ -803,7 +803,7 @@ pub enum ret_style {
 pub enum explicit_self_ {
     sty_static,                                // no self
     sty_value,                                 // `self`
-    sty_region(Option<@Lifetime>, mutability), // `&'lt self`
+    sty_region(Option<Lifetime>, mutability), // `&'lt self`
     sty_box(mutability),                       // `@self`
     sty_uniq                                   // `~self`
 }
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index c933caa16c4..14ecc26a1c2 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -38,7 +38,7 @@ pub trait AstBuilder {
     fn path_all(&self, sp: span,
                 global: bool,
                 idents: ~[ast::ident],
-                rp: Option<@ast::Lifetime>,
+                rp: Option<ast::Lifetime>,
                 types: ~[@ast::Ty])
         -> ast::Path;
 
@@ -51,7 +51,7 @@ pub trait AstBuilder {
 
     fn ty_rptr(&self, span: span,
                ty: @ast::Ty,
-               lifetime: Option<@ast::Lifetime>,
+               lifetime: Option<ast::Lifetime>,
                mutbl: ast::mutability)
         -> @ast::Ty;
     fn ty_uniq(&self, span: span, ty: @ast::Ty) -> @ast::Ty;
@@ -238,7 +238,7 @@ impl AstBuilder for @ExtCtxt {
     fn path_all(&self, sp: span,
                 global: bool,
                 idents: ~[ast::ident],
-                rp: Option<@ast::Lifetime>,
+                rp: Option<ast::Lifetime>,
                 types: ~[@ast::Ty])
         -> ast::Path {
         ast::Path {
@@ -281,7 +281,7 @@ impl AstBuilder for @ExtCtxt {
     fn ty_rptr(&self,
                span: span,
                ty: @ast::Ty,
-               lifetime: Option<@ast::Lifetime>,
+               lifetime: Option<ast::Lifetime>,
                mutbl: ast::mutability)
         -> @ast::Ty {
         self.ty(span,
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index e397a416304..8bd74b96afc 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -351,7 +351,7 @@ impl<'self> TraitDef<'self> {
         let self_lifetime = if generics.lifetimes.is_empty() {
             None
         } else {
-            Some(@*generics.lifetimes.get(0))
+            Some(*generics.lifetimes.get(0))
         };
 
         // Create the type of `self`.
diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs
index 4dee2e2cdb8..2a60a20b872 100644
--- a/src/libsyntax/ext/deriving/ty.rs
+++ b/src/libsyntax/ext/deriving/ty.rs
@@ -110,9 +110,9 @@ pub fn nil_ty() -> Ty<'static> {
     Tuple(~[])
 }
 
-fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<@ast::Lifetime> {
+fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifetime> {
     match *lt {
-        Some(ref s) => Some(@cx.lifetime(span, cx.ident_of(*s))),
+        Some(ref s) => Some(cx.lifetime(span, cx.ident_of(*s))),
         None => None
     }
 }
@@ -171,7 +171,7 @@ impl<'self> Ty<'self> {
                 let lifetime = if self_generics.lifetimes.is_empty() {
                     None
                 } else {
-                    Some(@*self_generics.lifetimes.get(0))
+                    Some(*self_generics.lifetimes.get(0))
                 };
 
                 cx.path_all(span, false, ~[self_ty], lifetime,
@@ -251,8 +251,7 @@ pub fn get_explicit_self(cx: @ExtCtxt, span: span, self_ptr: &Option<PtrTy>)
                     Send => ast::sty_uniq,
                     Managed(mutbl) => ast::sty_box(mutbl),
                     Borrowed(ref lt, mutbl) => {
-                        let lt = lt.map(|s| @cx.lifetime(span,
-                                                         cx.ident_of(*s)));
+                        let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(*s)));
                         ast::sty_region(lt, mutbl)
                     }
                 });
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 00386f611b1..1959649a865 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -646,7 +646,7 @@ impl Parser {
     // parse a ty_closure type
     pub fn parse_ty_closure(&self,
                             sigil: ast::Sigil,
-                            region: Option<@ast::Lifetime>)
+                            region: Option<ast::Lifetime>)
                             -> ty_ {
         /*
 
@@ -985,7 +985,7 @@ impl Parser {
         // @'foo fn() or @foo/fn() or @fn() are parsed directly as fn types:
         match *self.token {
             token::LIFETIME(*) => {
-                let lifetime = @self.parse_lifetime();
+                let lifetime = self.parse_lifetime();
                 self.bump();
                 return self.parse_ty_closure(sigil, Some(lifetime));
             }
@@ -994,7 +994,7 @@ impl Parser {
                 if self.look_ahead(1u) == token::BINOP(token::SLASH) &&
                     self.token_is_closure_keyword(&self.look_ahead(2u))
                 {
-                    let lifetime = @self.parse_lifetime();
+                    let lifetime = self.parse_lifetime();
                     self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
                     return self.parse_ty_closure(sigil, Some(lifetime));
                 } else if self.token_is_closure_keyword(&copy *self.token) {
@@ -1263,7 +1263,7 @@ impl Parser {
                     token::IDENT(sid, _) => {
                         let span = copy self.span;
                         self.bump();
-                        Some(@ast::Lifetime {
+                        Some(ast::Lifetime {
                             id: self.get_id(),
                             span: *span,
                             ident: sid
@@ -1288,7 +1288,7 @@ impl Parser {
                 if v.len() == 0 {
                     None
                 } else if v.len() == 1 {
-                    Some(@*v.get(0))
+                    Some(*v.get(0))
                 } else {
                     self.fatal(fmt!("Expected at most one \
                                      lifetime name (for now)"));
@@ -1322,17 +1322,17 @@ impl Parser {
     }
 
     /// parses 0 or 1 lifetime
-    pub fn parse_opt_lifetime(&self) -> Option<@ast::Lifetime> {
+    pub fn parse_opt_lifetime(&self) -> Option<ast::Lifetime> {
         match *self.token {
             token::LIFETIME(*) => {
-                Some(@self.parse_lifetime())
+                Some(self.parse_lifetime())
             }
 
             // Also accept the (obsolete) syntax `foo/`
             token::IDENT(*) => {
                 if self.look_ahead(1u) == token::BINOP(token::SLASH) {
                     self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
-                    Some(@self.parse_lifetime())
+                    Some(self.parse_lifetime())
                 } else {
                     None
                 }
@@ -3343,14 +3343,14 @@ impl Parser {
             } else if (this.token_is_lifetime(&this.look_ahead(1)) &&
                        token::is_keyword(keywords::Self, &this.look_ahead(2))) {
                 this.bump();
-                let lifetime = @this.parse_lifetime();
+                let lifetime = this.parse_lifetime();
                 this.expect_self_ident();
                 sty_region(Some(lifetime), m_imm)
             } else if (this.token_is_lifetime(&this.look_ahead(1)) &&
                        this.token_is_mutability(&this.look_ahead(2)) &&
                        token::is_keyword(keywords::Self, &this.look_ahead(3))) {
                 this.bump();
-                let lifetime = @this.parse_lifetime();
+                let lifetime = this.parse_lifetime();
                 let mutability = this.parse_mutability();
                 this.expect_self_ident();
                 sty_region(Some(lifetime), mutability)
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 36e9ba4b08a..d50eb8453d2 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -366,9 +366,9 @@ pub fn print_foreign_mod(s: @ps, nmod: &ast::foreign_mod,
     for nmod.items.iter().advance |item| { print_foreign_item(s, *item); }
 }
 
-pub fn print_opt_lifetime(s: @ps, lifetime: Option<@ast::Lifetime>) {
+pub fn print_opt_lifetime(s: @ps, lifetime: &Option<ast::Lifetime>) {
     for lifetime.iter().advance |l| {
-        print_lifetime(s, *l);
+        print_lifetime(s, l);
         nbsp(s);
     }
 }
@@ -392,7 +392,7 @@ pub fn print_type(s: @ps, ty: @ast::Ty) {
         word(s.s, "]");
       }
       ast::ty_ptr(ref mt) => { word(s.s, "*"); print_mt(s, mt); }
-      ast::ty_rptr(lifetime, ref mt) => {
+      ast::ty_rptr(ref lifetime, ref mt) => {
           word(s.s, "&");
           print_opt_lifetime(s, lifetime);
           print_mt(s, mt);
@@ -408,14 +408,14 @@ pub fn print_type(s: @ps, ty: @ast::Ty) {
       ast::ty_bare_fn(f) => {
           let generics = ast::Generics {lifetimes: copy f.lifetimes,
                                         ty_params: opt_vec::Empty};
-          print_ty_fn(s, Some(f.abis), None, None,
+          print_ty_fn(s, Some(f.abis), None, &None,
                       f.purity, ast::Many, &f.decl, None, &None,
                       Some(&generics), None);
       }
       ast::ty_closure(f) => {
           let generics = ast::Generics {lifetimes: copy f.lifetimes,
                                         ty_params: opt_vec::Empty};
-          print_ty_fn(s, None, Some(f.sigil), f.region,
+          print_ty_fn(s, None, Some(f.sigil), &f.region,
                       f.purity, f.onceness, &f.decl, None, &f.bounds,
                       Some(&generics), None);
       }
@@ -804,7 +804,7 @@ pub fn print_ty_method(s: @ps, m: &ast::ty_method) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, m.span.lo);
     print_outer_attributes(s, m.attrs);
-    print_ty_fn(s, None, None, None, m.purity, ast::Many,
+    print_ty_fn(s, None, None, &None, m.purity, ast::Many,
                 &m.decl, Some(m.ident), &None, Some(&m.generics),
                 Some(/*bad*/ copy m.explicit_self.node));
     word(s.s, ";");
@@ -1021,7 +1021,7 @@ pub fn print_vstore(s: @ps, t: ast::vstore) {
         ast::vstore_fixed(None) => word(s.s, "_"),
         ast::vstore_uniq => word(s.s, "~"),
         ast::vstore_box => word(s.s, "@"),
-        ast::vstore_slice(r) => {
+        ast::vstore_slice(ref r) => {
             word(s.s, "&");
             print_opt_lifetime(s, r);
         }
@@ -1505,7 +1505,7 @@ fn print_path_(s: @ps, path: &ast::Path, colons_before_params: bool,
             word(s.s, "<");
 
             for path.rp.iter().advance |r| {
-                print_lifetime(s, *r);
+                print_lifetime(s, r);
                 if !path.types.is_empty() {
                     word_space(s, ",");
                 }
@@ -1653,7 +1653,7 @@ pub fn print_explicit_self(s: @ps, explicit_self: ast::explicit_self_) -> bool {
         ast::sty_static => { return false; }
         ast::sty_value => { word(s.s, "self"); }
         ast::sty_uniq => { word(s.s, "~self"); }
-        ast::sty_region(lt, m) => {
+        ast::sty_region(ref lt, m) => {
             word(s.s, "&");
             print_opt_lifetime(s, lt);
             print_mutability(s, m);
@@ -1912,7 +1912,7 @@ pub fn print_arg(s: @ps, input: ast::arg) {
 pub fn print_ty_fn(s: @ps,
                    opt_abis: Option<AbiSet>,
                    opt_sigil: Option<ast::Sigil>,
-                   opt_region: Option<@ast::Lifetime>,
+                   opt_region: &Option<ast::Lifetime>,
                    purity: ast::purity,
                    onceness: ast::Onceness,
                    decl: &ast::fn_decl,