about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-20 16:01:32 +0000
committerbors <bors@rust-lang.org>2014-07-20 16:01:32 +0000
commitdf997e53afa442cd571100e40c1a22c12a956e40 (patch)
tree1840e1a5260edf570be6e01a37e8ad21e5ba0889 /src/libsyntax
parent8859df7fb5feecd7c397566fcb966c9afabbb7b2 (diff)
parenta2467b945c43eac05e46ac55d990aa9fb89ed581 (diff)
downloadrust-df997e53afa442cd571100e40c1a22c12a956e40.tar.gz
rust-df997e53afa442cd571100e40c1a22c12a956e40.zip
auto merge of #15814 : kvark/rust/ast, r=huonw
Makes working with syntax deriving a bit more pleasuring. For instance, once can use local (non-static) strings anywhere inside `TraitDef` now.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/deriving/generic/ty.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs
index 06eb92e1b27..5d8b5660698 100644
--- a/src/libsyntax/ext/deriving/generic/ty.rs
+++ b/src/libsyntax/ext/deriving/generic/ty.rs
@@ -24,6 +24,7 @@ use parse::token::special_idents;
 use std::gc::Gc;
 
 /// The types of pointers
+#[deriving(Clone)]
 pub enum PtrTy<'a> {
     /// &'lifetime mut
     Borrowed(Option<&'a str>, ast::Mutability),
@@ -31,6 +32,7 @@ pub enum PtrTy<'a> {
 
 /// A path, e.g. `::std::option::Option::<int>` (global). Has support
 /// for type parameters and a lifetime.
+#[deriving(Clone)]
 pub struct Path<'a> {
     pub path: Vec<&'a str> ,
     pub lifetime: Option<&'a str>,
@@ -81,6 +83,7 @@ impl<'a> Path<'a> {
 }
 
 /// A type. Supports pointers (except for *), Self, and literals
+#[deriving(Clone)]
 pub enum Ty<'a> {
     Self,
     /// &/Box/ Ty
@@ -107,7 +110,7 @@ pub fn borrowed_self<'r>() -> Ty<'r> {
     borrowed(box Self)
 }
 
-pub fn nil_ty() -> Ty<'static> {
+pub fn nil_ty<'r>() -> Ty<'r> {
     Tuple(Vec::new())
 }
 
@@ -205,13 +208,14 @@ fn mk_generics(lifetimes: Vec<ast::Lifetime>, ty_params: Vec<ast::TyParam> ) ->
 }
 
 /// Lifetimes and bounds on type parameters
+#[deriving(Clone)]
 pub struct LifetimeBounds<'a> {
     pub lifetimes: Vec<&'a str>,
     pub bounds: Vec<(&'a str, Option<ast::TyParamBound>, Vec<Path<'a>>)>,
 }
 
 impl<'a> LifetimeBounds<'a> {
-    pub fn empty() -> LifetimeBounds<'static> {
+    pub fn empty() -> LifetimeBounds<'a> {
         LifetimeBounds {
             lifetimes: Vec::new(), bounds: Vec::new()
         }