@@ -335,9 +335,12 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
335
335
}
336
336
337
337
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) ;
338
341
let f_t = type_of_fn ( ccx, sp, ast:: proto_fn, false , false ,
339
342
[ { mode: ast:: by_ref, ty: inner_t} ] ,
340
- ty :: mk_nil ( ccx . tcx ) , params) ;
343
+ nil_res , params) ;
341
344
ret trans:: get_extern_const ( ccx. externs , ccx. llmod ,
342
345
csearch:: get_symbol ( ccx. sess . get_cstore ( ) ,
343
346
did) ,
@@ -412,7 +415,7 @@ fn extend_path(cx: @local_ctxt, name: str) -> @local_ctxt {
412
415
}
413
416
414
417
fn rslt ( bcx : @block_ctxt , val : ValueRef ) -> result {
415
- ret { bcx : bcx, val : val} ;
418
+ { bcx: bcx, val: val}
416
419
}
417
420
418
421
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 {
843
846
!ty:: type_has_dynamic_size ( cx. tcx , t)
844
847
}
845
848
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
+
846
860
//
847
861
// Local Variables:
848
862
// mode: rust
0 commit comments