]> git.lizzy.rs Git - rust.git/commitdiff
extend with ty_send_type and ty_opaque_closure
authorNiko Matsakis <niko@alum.mit.edu>
Thu, 15 Dec 2011 22:30:19 +0000 (14:30 -0800)
committerNiko Matsakis <niko@alum.mit.edu>
Fri, 16 Dec 2011 16:06:44 +0000 (08:06 -0800)
src/comp/metadata/tydecode.rs
src/comp/metadata/tyencode.rs
src/comp/middle/shape.rs
src/comp/middle/trans.rs

index 434564f9c0d1d667ebe19830a2ad2dc969480cd3..5f87016866a87b277e384be4f46bdc4a56aaa044 100644 (file)
@@ -294,6 +294,8 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
       'X' { ret ty::mk_var(st.tcx, parse_int(st)); }
       'E' { let def = parse_def(st, sd); ret ty::mk_native(st.tcx, def); }
       'Y' { ret ty::mk_type(st.tcx); }
+      'y' { ret ty::mk_send_type(st.tcx); }
+      'C' { ret ty::mk_opaque_closure(st.tcx); }
       '#' {
         let pos = parse_hex(st);
         assert (next(st) as char == ':');
index 18ab46d7ef310d3f2dc66aef4450383c40cfc0fd..f779b64929fde47294c15523b9ebd039bfe68b46 100644 (file)
@@ -183,6 +183,8 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
         w.write_str(uint::str(id));
       }
       ty::ty_type. { w.write_char('Y'); }
+      ty::ty_send_type. { w.write_char('y'); }
+      ty::ty_opaque_closure. { w.write_char('C'); }
       ty::ty_constr(ty, cs) {
         w.write_str("A[");
         enc_ty(w, cx, ty);
index bd8d254137fff1fca85261e4641518fc6b512114..8ac5f471ded995443f2110a34f29a2278925483c 100644 (file)
@@ -305,7 +305,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint],
       ty::ty_int(ast::ty_i.) { s += [s_int(ccx.tcx)]; }
       ty::ty_float(ast::ty_f.) { s += [s_float(ccx.tcx)]; }
       ty::ty_uint(ast::ty_u.) | ty::ty_ptr(_) | ty::ty_type. |
-      ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
+      ty::ty_send_type. | ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
       ty::ty_int(ast::ty_i8.) { s += [shape_i8]; }
       ty::ty_uint(ast::ty_u16.) { s += [shape_u16]; }
       ty::ty_int(ast::ty_i16.) { s += [shape_i16]; }
index 42930b6c0311819f247dec159a2a332895a5fc44..de5954796fc01aa0df6c9edd2ff99e084d4db409 100644 (file)
@@ -192,7 +192,7 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
         std::util::unreachable()
       }
       ty::ty_param(_, _) { T_typaram(cx.tn) }
-      ty::ty_type. { T_ptr(cx.tydesc_type) }
+      ty::ty_send_type. | ty::ty_type. { T_ptr(cx.tydesc_type) }
       ty::ty_tup(elts) {
         let tys = [];
         for elt in elts {
@@ -204,6 +204,11 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
       ty::ty_opaque_closure. {
         T_opaque_closure(cx)
       }
+      _ {
+        log_err ("type_of_inner not implemented for ",
+                ty::struct(cx.tcx, t));
+        fail "type_of_inner not implemented for this kind of type";
+      }
     };
     cx.lltypes.insert(t, llty);
     ret llty;