about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/generic
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-08-31 12:50:55 +0000
committerbors <bors@rust-lang.org>2014-08-31 12:50:55 +0000
commit27e8d5bca79c09258c757e9be6e13aaa24086d84 (patch)
tree76b2a3bd57c4927f4caca9db20f4f0a8c21f6bb5 /src/libsyntax/ext/deriving/generic
parentdb47aa5bdf308213b4198b81e9d2e406ec716189 (diff)
parent2b312eca89c4da41403f594d9a8887dfed55d54c (diff)
downloadrust-27e8d5bca79c09258c757e9be6e13aaa24086d84.tar.gz
rust-27e8d5bca79c09258c757e9be6e13aaa24086d84.zip
auto merge of #16788 : Manishearth/rust/raw-ptr-syntax-ty, r=huonw
@huonw , r? :)

#16781 
Diffstat (limited to 'src/libsyntax/ext/deriving/generic')
-rw-r--r--src/libsyntax/ext/deriving/generic/ty.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs
index f4a9b85f75d..8b4a9c51cf0 100644
--- a/src/libsyntax/ext/deriving/generic/ty.rs
+++ b/src/libsyntax/ext/deriving/generic/ty.rs
@@ -28,6 +28,8 @@ use std::gc::Gc;
 pub enum PtrTy<'a> {
     /// &'lifetime mut
     Borrowed(Option<&'a str>, ast::Mutability),
+    /// *mut
+    Raw(ast::Mutability),
 }
 
 /// A path, e.g. `::std::option::Option::<int>` (global). Has support
@@ -82,7 +84,7 @@ impl<'a> Path<'a> {
     }
 }
 
-/// A type. Supports pointers (except for *), Self, and literals
+/// A type. Supports pointers, Self, and literals
 #[deriving(Clone)]
 pub enum Ty<'a> {
     Self,
@@ -143,6 +145,7 @@ impl<'a> Ty<'a> {
                         let lt = mk_lifetime(cx, span, lt);
                         cx.ty_rptr(span, raw_ty, lt, mutbl)
                     }
+                    Raw(mutbl) => cx.ty_ptr(span, raw_ty, mutbl)
                 }
             }
             Literal(ref p) => { p.to_ty(cx, span, self_ty, self_generics) }
@@ -273,6 +276,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
                         let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(s).name));
                         ast::SelfRegion(lt, mutbl, special_idents::self_)
                     }
+                    Raw(_) => cx.span_bug(span, "attempted to use *self in deriving definition")
                 });
             let self_expr = cx.expr_deref(span, self_path);
             (self_expr, self_ty)