1
Fork 0

rustc: Start accepting *const T

This does not yet change the compiler and libraries from `*T` to `*const T` as
it will require a snapshot to do so.

cc #7362
This commit is contained in:
Alex Crichton 2014-06-16 16:58:17 -07:00
parent 0973eb4419
commit 3324257833
5 changed files with 38 additions and 11 deletions

View file

@ -1352,7 +1352,7 @@ impl<'a> Parser<'a> {
} else if self.token == token::BINOP(token::STAR) {
// STAR POINTER (bare pointer?)
self.bump();
TyPtr(self.parse_mt())
TyPtr(self.parse_ptr())
} else if self.token == token::LBRACKET {
// VECTOR
self.expect(&token::LBRACKET);
@ -1429,6 +1429,19 @@ impl<'a> Parser<'a> {
return TyRptr(opt_lifetime, mt);
}
pub fn parse_ptr(&mut self) -> MutTy {
let mutbl = if self.eat_keyword(keywords::Mut) {
MutMutable
} else if self.eat_keyword(keywords::Const) {
MutImmutable
} else {
// NOTE: after a stage0 snap this should turn into a span_err.
MutImmutable
};
let t = self.parse_ty(true);
MutTy { ty: t, mutbl: mutbl }
}
pub fn is_named_argument(&mut self) -> bool {
let offset = match self.token {
token::BINOP(token::AND) => 1,