about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/middle/kind.rs4
-rw-r--r--src/librustc/middle/ty.rs2
-rw-r--r--src/libsyntax/parse/parser.rs77
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/test/compile-fail/kindck-owned-trait-scoped.rs4
-rw-r--r--src/test/compile-fail/kindck-owned-trait.rs4
-rw-r--r--src/test/compile-fail/kindck-owned.rs8
-rw-r--r--src/test/compile-fail/static-region-bound.rs2
-rw-r--r--src/test/run-pass/alignment-gep-tup-like-1.rs2
-rw-r--r--src/test/run-pass/close-over-big-then-small-data.rs2
-rw-r--r--src/test/run-pass/fixed-point-bind-unique.rs4
-rw-r--r--src/test/run-pass/issue-2734.rs2
-rw-r--r--src/test/run-pass/issue-2735.rs2
-rw-r--r--src/test/run-pass/issue-2904.rs2
14 files changed, 60 insertions, 57 deletions
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 0564e244437..ef8857d444a 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -376,7 +376,7 @@ pub fn check_bounds(cx: Context,
 
             ty::bound_durable => {
                 if !kind.is_durable(cx.tcx) {
-                    missing.push("&static");
+                    missing.push("'static");
                 }
             }
 
@@ -467,7 +467,7 @@ pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool {
         match ty::get(ty).sty {
           ty::ty_param(*) => {
             tcx.sess.span_err(sp, ~"value may contain borrowed \
-                                    pointers; use `&static` bound");
+                                    pointers; use `'static` bound");
           }
           _ => {
             tcx.sess.span_err(sp, ~"value may contain borrowed \
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 065942b8fe6..e3b315068f3 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -1404,7 +1404,7 @@ pub fn substs_to_str(cx: ctxt, substs: &substs) -> ~str {
 pub fn param_bound_to_str(cx: ctxt, pb: &param_bound) -> ~str {
     match *pb {
         bound_copy => ~"copy",
-        bound_durable => ~"&static",
+        bound_durable => ~"'static",
         bound_owned => ~"owned",
         bound_const => ~"const",
         bound_trait(t) => ::util::ppaux::ty_to_str(cx, t)
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e899c79a74c..07f8c8b743b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2704,49 +2704,52 @@ pub impl Parser {
 
         let mut result = opt_vec::Empty;
         loop {
-            if self.eat(&token::BINOP(token::AND)) {
-                if self.eat_keyword(&~"static") {
-                    result.push(RegionTyParamBound);
-                } else {
-                    self.span_err(*self.span,
-                                  ~"`&static` is the only permissible \
-                                    region bound here");
+            match *self.token {
+                token::LIFETIME(lifetime) => {
+                    if str::eq_slice(*self.id_to_str(lifetime), "static") {
+                        result.push(RegionTyParamBound);
+                    } else {
+                        self.span_err(*self.span,
+                                      ~"`'static` is the only permissible \
+                                        region bound here");
+                    }
+                    self.bump();
                 }
-            } else if is_ident(&*self.token) {
-                let maybe_bound = match *self.token {
-                    token::IDENT(copy sid, _) => {
-                        match *self.id_to_str(sid) {
-                            ~"send" |
-                            ~"copy" |
-                            ~"const" |
-                            ~"owned" => {
-                                self.obsolete(
-                                    *self.span,
-                                    ObsoleteLowerCaseKindBounds);
-
-                                // Bogus value, but doesn't matter, since
-                                // is an error
-                                Some(TraitTyParamBound(
-                                    self.mk_ty_path(sid)))
+                token::IDENT(*) => {
+                    let maybe_bound = match *self.token {
+                        token::IDENT(copy sid, _) => {
+                            match *self.id_to_str(sid) {
+                                ~"send" |
+                                ~"copy" |
+                                ~"const" |
+                                ~"owned" => {
+                                    self.obsolete(
+                                        *self.span,
+                                        ObsoleteLowerCaseKindBounds);
+
+                                    // Bogus value, but doesn't matter, since
+                                    // is an error
+                                    Some(TraitTyParamBound(
+                                        self.mk_ty_path(sid)))
+                                }
+                                _ => None
                             }
-                            _ => None
                         }
-                    }
-                    _ => fail!()
-                };
+                        _ => fail!()
+                    };
 
-                match maybe_bound {
-                    Some(bound) => {
-                        self.bump();
-                        result.push(bound);
-                    }
-                    None => {
-                        let ty = self.parse_ty(false);
-                        result.push(TraitTyParamBound(ty));
+                    match maybe_bound {
+                        Some(bound) => {
+                            self.bump();
+                            result.push(bound);
+                        }
+                        None => {
+                            let ty = self.parse_ty(false);
+                            result.push(TraitTyParamBound(ty));
+                        }
                     }
                 }
-            } else {
-                break;
+                _ => break,
             }
 
             if self.eat(&token::BINOP(token::PLUS)) {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 2bb053cc03a..27c4763e973 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1755,7 +1755,7 @@ pub fn print_bounds(s: @ps, bounds: @OptVec<ast::TyParamBound>) {
 
             match *bound {
                 TraitTyParamBound(ty) => print_type(s, ty),
-                RegionTyParamBound => word(s.s, ~"&static"),
+                RegionTyParamBound => word(s.s, ~"'static"),
             }
         }
     }
diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs
index 63690f03093..34ceb67f243 100644
--- a/src/test/compile-fail/kindck-owned-trait-scoped.rs
+++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs
@@ -37,10 +37,10 @@ fn to_foo_2<T:Copy>(t: T) -> @foo {
     // Not OK---T may contain borrowed ptrs and it is going to escape
     // as part of the returned foo value
     struct F<T> { f: T }
-    @F {f:t} as @foo //~ ERROR value may contain borrowed pointers; use `&static` bound
+    @F {f:t} as @foo //~ ERROR value may contain borrowed pointers; use `'static` bound
 }
 
-fn to_foo_3<T:Copy + &static>(t: T) -> @foo {
+fn to_foo_3<T:Copy + 'static>(t: T) -> @foo {
     // OK---T may escape as part of the returned foo value, but it is
     // owned and hence does not contain borrowed ptrs
     struct F<T> { f: T }
diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs
index af6924ef608..c61bbc69be5 100644
--- a/src/test/compile-fail/kindck-owned-trait.rs
+++ b/src/test/compile-fail/kindck-owned-trait.rs
@@ -11,10 +11,10 @@
 trait foo { fn foo(&self); }
 
 fn to_foo<T:Copy + foo>(t: T) -> @foo {
-    @t as @foo //~ ERROR value may contain borrowed pointers; use `&static` bound
+    @t as @foo //~ ERROR value may contain borrowed pointers; use `'static` bound
 }
 
-fn to_foo2<T:Copy + foo + &static>(t: T) -> @foo {
+fn to_foo2<T:Copy + foo + 'static>(t: T) -> @foo {
     @t as @foo
 }
 
diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs
index 31ab555b38a..27cc07ed123 100644
--- a/src/test/compile-fail/kindck-owned.rs
+++ b/src/test/compile-fail/kindck-owned.rs
@@ -13,22 +13,22 @@ fn copy1<T:Copy>(t: T) -> @fn() -> T {
     result
 }
 
-fn copy2<T:Copy + &static>(t: T) -> @fn() -> T {
+fn copy2<T:Copy + 'static>(t: T) -> @fn() -> T {
     let result: @fn() -> T = || t;
     result
 }
 
 fn main() {
     let x = &3;
-    copy2(&x); //~ ERROR does not fulfill `&static`
+    copy2(&x); //~ ERROR does not fulfill `'static`
 
     copy2(@3);
-    copy2(@&x); //~ ERROR does not fulfill `&static`
+    copy2(@&x); //~ ERROR does not fulfill `'static`
 
     let boxed: @fn() = || {};
     copy2(boxed);
     let owned: ~fn() = || {};
     copy2(owned);    //~ ERROR does not fulfill `Copy`
     let borrowed: &fn() = || {};
-    copy2(borrowed); //~ ERROR does not fulfill `&static`
+    copy2(borrowed); //~ ERROR does not fulfill `'static`
 }
diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs
index b70b0cdf881..500a5b0c8bc 100644
--- a/src/test/compile-fail/static-region-bound.rs
+++ b/src/test/compile-fail/static-region-bound.rs
@@ -1,4 +1,4 @@
-fn f<T:&static>(_: T) {}
+fn f<T:'static>(_: T) {}
 
 fn main() {
     let x = @3;
diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs
index 4c99e6f1a09..f9ba6ed7f54 100644
--- a/src/test/run-pass/alignment-gep-tup-like-1.rs
+++ b/src/test/run-pass/alignment-gep-tup-like-1.rs
@@ -12,7 +12,7 @@ struct pair<A,B> {
     a: A, b: B
 }
 
-fn f<A:Copy + &static>(a: A, b: u16) -> @fn() -> (A, u16) {
+fn f<A:Copy + 'static>(a: A, b: u16) -> @fn() -> (A, u16) {
     let result: @fn() -> (A, u16) = || (a, b);
     result
 }
diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs
index 518bc48b8ae..5a853d9fe21 100644
--- a/src/test/run-pass/close-over-big-then-small-data.rs
+++ b/src/test/run-pass/close-over-big-then-small-data.rs
@@ -16,7 +16,7 @@ struct Pair<A,B> {
     a: A, b: B
 }
 
-fn f<A:Copy + &static>(a: A, b: u16) -> @fn() -> (A, u16) {
+fn f<A:Copy + 'static>(a: A, b: u16) -> @fn() -> (A, u16) {
     let result: @fn() -> (A, u16) = || (a, b);
     result
 }
diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs
index fcd3b2e0a18..d79cd36d8fc 100644
--- a/src/test/run-pass/fixed-point-bind-unique.rs
+++ b/src/test/run-pass/fixed-point-bind-unique.rs
@@ -10,11 +10,11 @@
 
 // xfail-fast
 
-fn fix_help<A:&static,B:Owned>(f: extern fn(@fn(A) -> B, A) -> B, x: A) -> B {
+fn fix_help<A:'static,B:Owned>(f: extern fn(@fn(A) -> B, A) -> B, x: A) -> B {
     return f(|a| fix_help(f, a), x);
 }
 
-fn fix<A:&static,B:Owned>(f: extern fn(@fn(A) -> B, A) -> B) -> @fn(A) -> B {
+fn fix<A:'static,B:Owned>(f: extern fn(@fn(A) -> B, A) -> B) -> @fn(A) -> B {
     return |a| fix_help(f, a);
 }
 
diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs
index 35c3d6a88ee..7125e89287c 100644
--- a/src/test/run-pass/issue-2734.rs
+++ b/src/test/run-pass/issue-2734.rs
@@ -11,7 +11,7 @@
 trait hax { } 
 impl<A> hax for A { } 
 
-fn perform_hax<T:&static>(x: @T) -> @hax {
+fn perform_hax<T:'static>(x: @T) -> @hax {
     @x as @hax
 }
 
diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs
index ef6363043ee..9a5a366c744 100644
--- a/src/test/run-pass/issue-2735.rs
+++ b/src/test/run-pass/issue-2735.rs
@@ -11,7 +11,7 @@
 trait hax { }
 impl<A> hax for A { }
 
-fn perform_hax<T:&static>(x: @T) -> @hax {
+fn perform_hax<T:'static>(x: @T) -> @hax {
     @x as @hax
 }
 
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index 9538ebc554c..49c8d27814c 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -59,7 +59,7 @@ fn square_from_char(c: char) -> square {
     }
 }
 
-fn read_board_grid<rdr: &static + io::Reader>(+in: rdr) -> ~[~[square]] {
+fn read_board_grid<rdr:'static + io::Reader>(+in: rdr) -> ~[~[square]] {
     let in = @in as @io::Reader;
     let mut grid = ~[];
     for in.each_line |line| {