diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index da94195ab93..85e525e8823 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -323,6 +323,7 @@ tag ty_ { ty_str; ty_box(mt); ty_vec(mt); + ty_ptr(mt); ty_task; ty_port(@ty); ty_chan(@ty); diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 688bfb01e19..d7fecee6ca4 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -511,6 +511,11 @@ fn parse_ty(&parser p) -> @ast::ty { auto mt = parse_mt(p); hi = mt.ty.span.hi; t = ast::ty_box(mt); + } else if (p.peek() == token::BINOP(token::STAR)) { + p.bump(); + auto mt = parse_mt(p); + hi = mt.ty.span.hi; + t = ast::ty_ptr(mt); } else if (eat_word(p, "vec")) { expect(p, token::LBRACKET); t = ast::ty_vec(parse_mt(p)); diff --git a/src/test/run-pass/type-ptr.rs b/src/test/run-pass/type-ptr.rs new file mode 100644 index 00000000000..8ccbba9218d --- /dev/null +++ b/src/test/run-pass/type-ptr.rs @@ -0,0 +1,6 @@ +fn f(*int a) { +} + +fn main(vec[str] args) { + ret; +}