mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
Implement enough support for pointer to get an identity function working.
This commit is contained in:
parent
4bd5f834b0
commit
ee54fa5c7d
@ -615,6 +615,7 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
|
||||
case (ty_char) { s += "char"; }
|
||||
case (ty_str) { s += "str"; }
|
||||
case (ty_box(?tm)) { s += "@" + mt_to_str(cx, tm); }
|
||||
case (ty_ptr(?tm)) { s += "*" + mt_to_str(cx, tm); }
|
||||
case (ty_vec(?tm)) { s += "vec[" + mt_to_str(cx, tm) + "]"; }
|
||||
case (ty_port(?t)) { s += "port[" + ty_to_str(cx, t) + "]"; }
|
||||
case (ty_chan(?t)) { s += "chan[" + ty_to_str(cx, t) + "]"; }
|
||||
@ -781,6 +782,10 @@ fn fold_ty(&ctxt cx, ty_fold fld, t ty_0) -> t {
|
||||
ty = copy_cname(cx, mk_box(cx, rec(ty=fold_ty(cx, fld, tm.ty),
|
||||
mut=tm.mut)), ty);
|
||||
}
|
||||
case (ty_ptr(?tm)) {
|
||||
ty = copy_cname(cx, mk_ptr(cx, rec(ty=fold_ty(cx, fld, tm.ty),
|
||||
mut=tm.mut)), ty);
|
||||
}
|
||||
case (ty_vec(?tm)) {
|
||||
ty = copy_cname(cx, mk_vec(cx, rec(ty=fold_ty(cx, fld, tm.ty),
|
||||
mut=tm.mut)), ty);
|
||||
@ -978,6 +983,7 @@ fn type_is_scalar(&ctxt cx, &t ty) -> bool {
|
||||
case (ty_char) { ret true; }
|
||||
case (ty_type) { ret true; }
|
||||
case (ty_native) { ret true; }
|
||||
case (ty_ptr(_)) { ret true; }
|
||||
case (_) { ret false; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,10 @@
|
||||
fn f(*int a) {
|
||||
fn f(*int a) -> *int {
|
||||
ret a;
|
||||
}
|
||||
|
||||
fn g(*int a) -> *int {
|
||||
auto b = f(a);
|
||||
ret b;
|
||||
}
|
||||
|
||||
fn main(vec[str] args) {
|
||||
|
Loading…
Reference in New Issue
Block a user