about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-04 03:41:50 -0700
committerbors <bors@rust-lang.org>2014-05-04 03:41:50 -0700
commitde99da3fa5d234e5938b4d87dd264b01eb6e86ac (patch)
treef0c2c8296caf4374fc315a58a3f918daf9601910 /src/libsyntax
parent0f9a74fea47a7af15046ae2908af6db3ed368b1c (diff)
parent92b741aad4e329c134544c460b50eb095c0e512e (diff)
downloadrust-de99da3fa5d234e5938b4d87dd264b01eb6e86ac.tar.gz
rust-de99da3fa5d234e5938b4d87dd264b01eb6e86ac.zip
auto merge of #13898 : nikomatsakis/rust/type-bounds-b, r=acrichto
This is needed to bootstrap fix for #5723.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs3
-rw-r--r--src/libsyntax/fold.rs3
-rw-r--r--src/libsyntax/parse/parser.rs7
-rw-r--r--src/libsyntax/print/pprust.rs6
-rw-r--r--src/libsyntax/visit.rs3
5 files changed, 13 insertions, 9 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 49617a44a86..a5058de2c61 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -173,7 +173,8 @@ pub static DUMMY_NODE_ID: NodeId = -1;
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub enum TyParamBound {
     TraitTyParamBound(TraitRef),
-    RegionTyParamBound
+    StaticRegionTyParamBound,
+    OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands
 }
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 47ef23b82d2..685e08dd918 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -437,7 +437,8 @@ fn fold_ty_param_bound<T: Folder>(tpb: &TyParamBound, fld: &mut T)
                                     -> TyParamBound {
     match *tpb {
         TraitTyParamBound(ref ty) => TraitTyParamBound(fold_trait_ref(ty, fld)),
-        RegionTyParamBound => RegionTyParamBound
+        StaticRegionTyParamBound => StaticRegionTyParamBound,
+        OtherRegionTyParamBound(s) => OtherRegionTyParamBound(s)
     }
 }
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 6989ceb0d79..bb21bb0b898 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -12,7 +12,7 @@
 
 use abi;
 use ast::{BareFnTy, ClosureTy};
-use ast::{RegionTyParamBound, TraitTyParamBound};
+use ast::{StaticRegionTyParamBound, OtherRegionTyParamBound, TraitTyParamBound};
 use ast::{Provided, Public, FnStyle};
 use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindByRef, BindByValue};
 use ast::{BiBitAnd, BiBitOr, BiBitXor, Block};
@@ -3351,7 +3351,7 @@ impl<'a> Parser<'a> {
                 token::LIFETIME(lifetime) => {
                     let lifetime_interned_string = token::get_ident(lifetime);
                     if lifetime_interned_string.equiv(&("static")) {
-                        result.push(RegionTyParamBound);
+                        result.push(StaticRegionTyParamBound);
                         if allow_any_lifetime && ret_lifetime.is_none() {
                             ret_lifetime = Some(ast::Lifetime {
                                 id: ast::DUMMY_NODE_ID,
@@ -3366,8 +3366,7 @@ impl<'a> Parser<'a> {
                             name: lifetime.name
                         });
                     } else {
-                        self.span_err(self.span,
-                                      "`'static` is the only permissible region bound here");
+                        result.push(OtherRegionTyParamBound(self.span));
                     }
                     self.bump();
                 }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index f5fe92c3e67..fb823522612 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -9,7 +9,8 @@
 // except according to those terms.
 
 use abi;
-use ast::{P, RegionTyParamBound, TraitTyParamBound, Required, Provided};
+use ast::{P, StaticRegionTyParamBound, OtherRegionTyParamBound,
+          TraitTyParamBound, Required, Provided};
 use ast;
 use ast_util;
 use owned_slice::OwnedSlice;
@@ -1881,7 +1882,8 @@ impl<'a> State<'a> {
 
                 try!(match *bound {
                     TraitTyParamBound(ref tref) => self.print_trait_ref(tref),
-                    RegionTyParamBound => word(&mut self.s, "'static"),
+                    StaticRegionTyParamBound => word(&mut self.s, "'static"),
+                    OtherRegionTyParamBound(_) => Ok(())
                 })
             }
             Ok(())
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 260ba247092..f715b3a68ae 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -472,7 +472,8 @@ pub fn walk_ty_param_bounds<E: Clone, V: Visitor<E>>(visitor: &mut V,
             TraitTyParamBound(ref typ) => {
                 walk_trait_ref_helper(visitor, typ, env.clone())
             }
-            RegionTyParamBound => {}
+            StaticRegionTyParamBound => {}
+            OtherRegionTyParamBound(..) => {}
         }
     }
 }