Skip to content

Commit c3e627e

Browse files
committed
---
yaml --- r: 5342 b: refs/heads/master c: 172df2e h: refs/heads/master v: v3
1 parent 7df7c4b commit c3e627e

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 469853d5ffef308f49f64110a8c057ecb842cb2e
2+
refs/heads/master: 172df2e3a224f58eb0fe162436fa1aa8d87e224b

trunk/src/comp/middle/trans.rs

+13-6
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ fn type_of_explicit_args(cx: @crate_ctxt, sp: span, inputs: [ty::arg]) ->
7474
// - trans_args
7575
fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
7676
is_method: bool, ret_ref: bool, inputs: [ty::arg],
77-
output: ty::t, ty_param_count: uint) -> TypeRef {
77+
output: ty::t, ty_param_count: uint)
78+
: non_ty_var(cx, output) -> TypeRef {
7879
let atys: [TypeRef] = [];
7980

8081
// Arg 0: Output pointer.
81-
check non_ty_var(cx, output);
8282
let out_ty = T_ptr(type_of_inner(cx, sp, output));
8383
atys += [ret_ref ? T_ptr(out_ty) : out_ty];
8484

@@ -2073,6 +2073,7 @@ fn move_val(cx: @block_ctxt, action: copy_action, dst: ValueRef,
20732073
// If we're here, it must be a temporary.
20742074
ret revoke_clean(cx, src_val, t);
20752075
}
2076+
/* FIXME: suggests a type constraint */
20762077
bcx_ccx(cx).sess.bug("unexpected type in trans::move_val: " +
20772078
ty_to_str(tcx, t));
20782079
}
@@ -2999,12 +3000,18 @@ fn trans_field(cx: @block_ctxt, sp: span, v: ValueRef, t0: ty::t,
29993000

30003001
let v = GEP(r.bcx, vtbl, [C_int(0), C_int(ix as int)]);
30013002
let tcx = bcx_tcx(cx);
3003+
let ccx = bcx_ccx(cx);
3004+
30023005
let fn_ty: ty::t = ty::method_ty_to_fn_ty(tcx, methods[ix]);
3006+
let ret_ty = ty::ty_fn_ret(tcx, fn_ty);
30033007
let ret_ref = ast_util::ret_by_ref(ty::ty_fn_ret_style(tcx, fn_ty));
3008+
// FIXME: constrain ty_obj?
3009+
check non_ty_var(ccx, ret_ty);
3010+
30043011
let ll_fn_ty =
3005-
type_of_fn(bcx_ccx(cx), sp, ty::ty_fn_proto(tcx, fn_ty),
3012+
type_of_fn(ccx, sp, ty::ty_fn_proto(tcx, fn_ty),
30063013
true, ret_ref, ty::ty_fn_args(tcx, fn_ty),
3007-
ty::ty_fn_ret(tcx, fn_ty), 0u);
3014+
ret_ty, 0u);
30083015
v = PointerCast(r.bcx, v, T_ptr(T_ptr(ll_fn_ty)));
30093016
let lvo = lval_mem(r.bcx, v);
30103017
ret {llobj: some::<ValueRef>(r.val) with lvo};
@@ -4581,7 +4588,7 @@ fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> result {
45814588
}
45824589
_ { bcx_ccx(cx).sess.unimpl("stmt variant"); }
45834590
}
4584-
ret rslt(bcx, C_nil());
4591+
rslt(bcx, C_nil())
45854592
}
45864593

45874594
// You probably don't want to use this one. See the
@@ -5438,7 +5445,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
54385445
let vecarg_ty: ty::arg =
54395446
{mode: ast::by_ref,
54405447
ty: ty::mk_vec(ccx.tcx, {ty: unit_ty, mut: ast::imm})};
5441-
// FIXME: mk_nil should have a post condition
5448+
// FIXME: mk_nil should have a postcondition
54425449
let nt = ty::mk_nil(ccx.tcx);
54435450
check non_ty_var(ccx, nt);
54445451

trunk/src/comp/middle/trans_objects.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,9 @@ fn process_normal_mthd(cx: @local_ctxt, m: @ast::method, self_ty: ty::t,
885885
ty_params: [ast::ty_param]) -> ValueRef {
886886

887887
let llfnty = T_nil();
888+
let ccx = cx.ccx;
888889
alt ty::struct(cx.ccx.tcx, node_id_type(cx.ccx, m.node.id)) {
889890
ty::ty_fn(proto, inputs, output, rs, _) {
890-
let ccx = cx.ccx;
891891
check non_ty_var(ccx, output);
892892
llfnty = type_of_fn(ccx, m.span, proto, true,
893893
ast_util::ret_by_ref(rs), inputs, output,
@@ -897,13 +897,13 @@ fn process_normal_mthd(cx: @local_ctxt, m: @ast::method, self_ty: ty::t,
897897
let mcx: @local_ctxt =
898898
@{path: cx.path + ["method", m.node.ident] with *cx};
899899
let s: str = mangle_internal_name_by_path(mcx.ccx, mcx.path);
900-
let llfn: ValueRef = decl_internal_fastcall_fn(cx.ccx.llmod, s, llfnty);
900+
let llfn: ValueRef = decl_internal_fastcall_fn(ccx.llmod, s, llfnty);
901901

902902
// Every method on an object gets its node_id inserted into the crate-wide
903903
// item_ids map, together with the ValueRef that points to where that
904904
// method's definition will be in the executable.
905-
cx.ccx.item_ids.insert(m.node.id, llfn);
906-
cx.ccx.item_symbols.insert(m.node.id, s);
905+
ccx.item_ids.insert(m.node.id, llfn);
906+
ccx.item_symbols.insert(m.node.id, s);
907907
trans_fn(mcx, m.span, m.node.meth, llfn, some(self_ty), ty_params,
908908
m.node.id);
909909

0 commit comments

Comments
 (0)