Accept *foo as a pointer to foo.
This is accepted everywhere, since just passing a pointer is safe.
This commit is contained in:
parent
07667d29aa
commit
18b63865ce
@ -323,6 +323,7 @@ fn unop_to_str(unop op) -> str {
|
|||||||
ty_str;
|
ty_str;
|
||||||
ty_box(mt);
|
ty_box(mt);
|
||||||
ty_vec(mt);
|
ty_vec(mt);
|
||||||
|
ty_ptr(mt);
|
||||||
ty_task;
|
ty_task;
|
||||||
ty_port(@ty);
|
ty_port(@ty);
|
||||||
ty_chan(@ty);
|
ty_chan(@ty);
|
||||||
|
@ -511,6 +511,11 @@ fn parse_ty(&parser p) -> @ast::ty {
|
|||||||
auto mt = parse_mt(p);
|
auto mt = parse_mt(p);
|
||||||
hi = mt.ty.span.hi;
|
hi = mt.ty.span.hi;
|
||||||
t = ast::ty_box(mt);
|
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")) {
|
} else if (eat_word(p, "vec")) {
|
||||||
expect(p, token::LBRACKET);
|
expect(p, token::LBRACKET);
|
||||||
t = ast::ty_vec(parse_mt(p));
|
t = ast::ty_vec(parse_mt(p));
|
||||||
|
6
src/test/run-pass/type-ptr.rs
Normal file
6
src/test/run-pass/type-ptr.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fn f(*int a) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main(vec[str] args) {
|
||||||
|
ret;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user