Skip to content

Commit b56d81e

Browse files
committed
---
yaml --- r: 5325 b: refs/heads/master c: f41f75f h: refs/heads/master i: 5323: de2dfa6 v: v3
1 parent 098b397 commit b56d81e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 059952da5b18e475b6018c1d58e3b5099c57fdba
2+
refs/heads/master: f41f75fe53b705d4363e91b8f66fd51e2b2f9fb5

trunk/src/comp/middle/trans_common.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,12 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
335335
}
336336

337337
let params = csearch::get_type_param_count(ccx.sess.get_cstore(), did);
338+
let nil_res = ty::mk_nil(ccx.tcx);
339+
// FIXME: Silly check -- mk_nil should have a postcondition
340+
check non_ty_var(ccx, nil_res);
338341
let f_t = type_of_fn(ccx, sp, ast::proto_fn, false, false,
339342
[{mode: ast::by_ref, ty: inner_t}],
340-
ty::mk_nil(ccx.tcx), params);
343+
nil_res, params);
341344
ret trans::get_extern_const(ccx.externs, ccx.llmod,
342345
csearch::get_symbol(ccx.sess.get_cstore(),
343346
did),
@@ -412,7 +415,7 @@ fn extend_path(cx: @local_ctxt, name: str) -> @local_ctxt {
412415
}
413416

414417
fn rslt(bcx: @block_ctxt, val: ValueRef) -> result {
415-
ret {bcx: bcx, val: val};
418+
{bcx: bcx, val: val}
416419
}
417420

418421
fn ty_str(tn: type_names, t: TypeRef) -> str {
@@ -843,6 +846,17 @@ pure fn type_has_static_size(cx: @crate_ctxt, t: ty::t) -> bool {
843846
!ty::type_has_dynamic_size(cx.tcx, t)
844847
}
845848

849+
pure fn non_ty_var(cx: @crate_ctxt, t: ty::t) -> bool {
850+
// Not obviously referentially transparent, but
851+
// type interner shouldn't be changing at this point.
852+
// FIXME: how to make that clearer?
853+
let st = unchecked { ty::struct(cx.tcx, t) };
854+
alt st {
855+
ty::ty_var(_) { false }
856+
_ { true }
857+
}
858+
}
859+
846860
//
847861
// Local Variables:
848862
// mode: rust

0 commit comments

Comments
 (0)