ty: P<ast::Ty>,
lifetime: Option<ast::Lifetime>,
mutbl: ast::Mutability) -> P<ast::Ty>;
+ fn ty_ptr(&self, span: Span,
+ ty: P<ast::Ty>,
+ mutbl: ast::Mutability) -> P<ast::Ty>;
fn ty_uniq(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty>;
fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty>;
ast::TyRptr(lifetime, self.ty_mt(ty, mutbl)))
}
+ fn ty_ptr(&self,
+ span: Span,
+ ty: P<ast::Ty>,
+ mutbl: ast::Mutability)
+ -> P<ast::Ty> {
+ self.ty(span,
+ ast::TyPtr(self.ty_mt(ty, mutbl)))
+ }
fn ty_uniq(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty> {
self.ty(span, ast::TyUniq(ty))
}
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
}
}
-/// A type. Supports pointers (except for *), Self, and literals
+/// A type. Supports pointers, Self, and literals
#[deriving(Clone)]
pub enum Ty<'a> {
Self,
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) }
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)