@@ -186,10 +186,6 @@ fn type_of_ty_param_bounds_and_ty
186
186
// fall through
187
187
}
188
188
}
189
- // FIXME: could have a precondition on tpt, but that
190
- // doesn't work right now because one predicate can't imply
191
- // another
192
- check type_has_static_size ( ccx, t) ;
193
189
type_of ( ccx, t)
194
190
}
195
191
@@ -523,7 +519,6 @@ fn trans_malloc_boxed_raw(bcx: block, t: ty::t,
523
519
// Grab the TypeRef type of box_ptr, because that's what trans_raw_malloc
524
520
// wants.
525
521
let box_ptr = ty:: mk_imm_box ( bcx. tcx ( ) , t) ;
526
- check ( type_has_static_size ( ccx, box_ptr) ) ;
527
522
let llty = type_of ( ccx, box_ptr) ;
528
523
529
524
// Get the tydesc for the body:
@@ -792,7 +787,6 @@ fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef,
792
787
ret llfn;
793
788
}
794
789
795
- // FIXME: was this causing the leak?
796
790
fn make_generic_glue_inner ( ccx : @crate_ctxt , t : ty:: t ,
797
791
llfn : ValueRef , helper : glue_helper ,
798
792
ty_params : [ uint ] ) -> ValueRef {
@@ -1218,7 +1212,6 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
1218
1212
j += 1 u;
1219
1213
}
1220
1214
}
1221
- // Precondition?
1222
1215
_ { cx. tcx ( ) . sess . bug ( "iter_variant: not a function type" ) ; }
1223
1216
}
1224
1217
ret cx;
@@ -1460,7 +1453,6 @@ fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
1460
1453
ty:: ty_box ( _) | ty:: ty_opaque_box {
1461
1454
decr_refcnt_maybe_free( bcx, v, t)
1462
1455
}
1463
- // Precondition?
1464
1456
_ { bcx. tcx ( ) . sess . bug ( "drop_ty_immediate: non-box ty" ) ; }
1465
1457
}
1466
1458
}
@@ -1608,9 +1600,8 @@ fn move_val(cx: block, action: copy_action, dst: ValueRef,
1608
1600
revoke_clean ( cx, src_val) ;
1609
1601
ret cx;
1610
1602
}
1611
- /* FIXME: suggests a type constraint */
1612
1603
cx. sess ( ) . bug ( "unexpected type in trans::move_val: " +
1613
- ty_to_str ( tcx, t) ) ;
1604
+ ty_to_str ( tcx, t) ) ;
1614
1605
}
1615
1606
1616
1607
fn store_temp_expr ( cx : block , action : copy_action , dst : ValueRef ,
@@ -1718,9 +1709,7 @@ fn trans_compare(cx: block, op: ast::binop, lhs: ValueRef,
1718
1709
ast : : eq | ast:: ne { llop = C_u8 ( abi:: cmp_glue_op_eq) ; }
1719
1710
ast:: lt | ast:: ge { llop = C_u8 ( abi:: cmp_glue_op_lt) ; }
1720
1711
ast:: le | ast:: gt { llop = C_u8 ( abi:: cmp_glue_op_le) ; }
1721
- // Precondition?
1722
- _ { cx. tcx ( ) . sess . bug ( "trans_compare got\
1723
- non-comparison-op") ; }
1712
+ _ { cx. tcx ( ) . sess . bug ( "trans_compare got non-comparison-op" ) ; }
1724
1713
}
1725
1714
1726
1715
let rs = call_cmp_glue ( cx, lhs, rhs, rhs_t, llop) ;
@@ -2000,7 +1989,6 @@ fn store_in_dest(bcx: block, val: ValueRef, dest: dest) -> block {
2000
1989
fn get_dest_addr ( dest : dest ) -> ValueRef {
2001
1990
alt dest {
2002
1991
save_in( a) { a }
2003
- // Precondition?
2004
1992
_ { fail "get_dest_addr: not a save_in" ; }
2005
1993
}
2006
1994
}
@@ -2079,7 +2067,7 @@ fn trans_while(cx: block, cond: @ast::expr, body: ast::blk)
2079
2067
-> block {
2080
2068
let next_cx = sub_block ( cx, "while next" ) ;
2081
2069
let cond_cx = loop_scope_block ( cx, cont_self, next_cx,
2082
- "while cond" , body. span ) ;
2070
+ "while cond" , body. span ) ;
2083
2071
let body_cx = scope_block ( cond_cx, "while loop body" ) ;
2084
2072
Br ( cx, cond_cx. llbb ) ;
2085
2073
let cond_res = trans_temp_expr ( cond_cx, cond) ;
@@ -2483,9 +2471,9 @@ fn trans_callee(bcx: block, e: @ast::expr) -> lval_maybe_callee {
2483
2471
some ( origin) { // An impl method
2484
2472
ret impl:: trans_method_callee ( bcx, e. id , base, origin) ;
2485
2473
}
2486
- // Precondition?
2487
- _ { bcx. tcx ( ) . sess . span_bug ( e. span , "trans_callee: weird\
2488
- expr" ) ; }
2474
+ _ {
2475
+ bcx. ccx ( ) . sess . span_bug ( e. span , "trans_callee: weird expr" ) ;
2476
+ }
2489
2477
}
2490
2478
}
2491
2479
}
@@ -2515,7 +2503,7 @@ fn trans_lval(cx: block, e: @ast::expr) -> lval_result {
2515
2503
let ccx = cx. ccx ( ) ;
2516
2504
let sub = trans_temp_expr ( cx, base) ;
2517
2505
let t = expr_ty ( cx, base) ;
2518
- let val = alt ty:: get ( t) . struct {
2506
+ let val = alt check ty:: get ( t) . struct {
2519
2507
ty:: ty_box ( _) {
2520
2508
GEPi ( sub. bcx , sub. val , [ 0 , abi:: box_field_body] )
2521
2509
}
@@ -2524,18 +2512,12 @@ fn trans_lval(cx: block, e: @ast::expr) -> lval_result {
2524
2512
}
2525
2513
ty:: ty_enum ( _, _) {
2526
2514
let ety = expr_ty ( cx, e) ;
2527
- let ellty =
2528
- if check type_has_static_size ( ccx, ety) {
2515
+ let ellty = if check type_has_static_size ( ccx, ety) {
2529
2516
T_ptr ( type_of ( ccx, ety) )
2530
2517
} else { T_typaram_ptr ( ccx. tn ) } ;
2531
2518
PointerCast ( sub. bcx , sub. val , ellty)
2532
2519
}
2533
2520
ty:: ty_ptr ( _) | ty:: ty_uniq ( _) { sub. val }
2534
- // Precondition?
2535
- _ {
2536
- cx. tcx ( ) . sess . span_bug ( e. span , "trans_lval:\
2537
- Weird argument in deref") ;
2538
- }
2539
2521
} ;
2540
2522
ret lval_owned( sub. bcx , val) ;
2541
2523
}
@@ -2602,9 +2584,6 @@ fn trans_cast(cx: block, e: @ast::expr, id: ast::node_id,
2602
2584
let e_res = trans_temp_expr ( cx, e) ;
2603
2585
let ll_t_in = val_ty ( e_res. val ) ;
2604
2586
let t_in = expr_ty ( cx, e) ;
2605
- // Check should be avoidable because it's a cast.
2606
- // FIXME: Constrain types so as to avoid this check.
2607
- check ( type_has_static_size ( ccx, t_out) ) ;
2608
2587
let ll_t_out = type_of ( ccx, t_out) ;
2609
2588
2610
2589
enum kind { pointer, integral, float, enum_, other, }
@@ -3210,11 +3189,6 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block {
3210
3189
ret trans_ret( bcx, ex) ;
3211
3190
}
3212
3191
ast:: expr_be ( ex) {
3213
- // Ideally, the expr_be enum would have a precondition
3214
- // that is_call_expr(ex) -- but we don't support that
3215
- // yet
3216
- // FIXME
3217
- check ( ast_util:: is_call_expr ( ex) ) ;
3218
3192
ret trans_be ( bcx, ex) ;
3219
3193
}
3220
3194
ast:: expr_fail ( expr) {
@@ -3526,9 +3500,7 @@ fn trans_ret(bcx: block, e: option<@ast::expr>) -> block {
3526
3500
3527
3501
fn build_return ( bcx : block ) { Br ( bcx, bcx. fcx . llreturn ) ; }
3528
3502
3529
- // fn trans_be(cx: &block, e: &@ast::expr) -> result {
3530
- fn trans_be( cx : block , e : @ast:: expr ) : ast_util:: is_call_expr ( e ) ->
3531
- block {
3503
+ fn trans_be ( cx : block , e : @ast:: expr ) -> block {
3532
3504
// FIXME: Turn this into a real tail call once
3533
3505
// calling convention issues are settled
3534
3506
ret trans_ret ( cx, some ( e) ) ;
@@ -4399,13 +4371,11 @@ fn trans_mod(ccx: @crate_ctxt, m: ast::_mod) {
4399
4371
4400
4372
fn get_pair_fn_ty ( llpairty : TypeRef ) -> TypeRef {
4401
4373
// Bit of a kludge: pick the fn typeref out of the pair.
4402
-
4403
4374
ret struct_elt ( llpairty, 0 u) ;
4404
4375
}
4405
4376
4406
4377
fn register_fn ( ccx : @crate_ctxt , sp : span , path : path , flav : str ,
4407
4378
ty_params : [ ast:: ty_param ] , node_id : ast:: node_id ) {
4408
- // FIXME: pull this out
4409
4379
let t = ty:: node_id_to_type ( ccx. tcx , node_id) ;
4410
4380
register_fn_full ( ccx, sp, path, flav, ty_params, node_id, t) ;
4411
4381
}
@@ -4461,7 +4431,6 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
4461
4431
let vecarg_ty: ty:: arg =
4462
4432
{ mode: ast:: expl ( ast:: by_val) ,
4463
4433
ty: ty:: mk_vec ( ccx. tcx , { ty: unit_ty, mutbl: ast:: m_imm} ) } ;
4464
- // FIXME: mk_nil should have a postcondition
4465
4434
let nt = ty:: mk_nil ( ccx. tcx ) ;
4466
4435
let llfty = type_of_fn ( ccx, [ vecarg_ty] , nt, [ ] ) ;
4467
4436
let llfdecl = decl_fn ( ccx. llmod , "_rust_main" ,
@@ -4600,10 +4569,7 @@ fn collect_item(ccx: @crate_ctxt, abi: @mutable option<ast::native_abi>,
4600
4569
ast:: item_const ( _, _) {
4601
4570
let typ = ty:: node_id_to_type ( ccx. tcx , i. id ) ;
4602
4571
let s = mangle_exported_name ( ccx, my_path, typ) ;
4603
- // FIXME: Could follow from a constraint on types of const
4604
- // items
4605
4572
let g = str:: as_buf ( s, { |buf|
4606
- check ( type_has_static_size ( ccx, typ) ) ;
4607
4573
llvm:: LLVMAddGlobal ( ccx. llmod , type_of ( ccx, typ) , buf)
4608
4574
} ) ;
4609
4575
ccx. item_symbols . insert ( i. id , s) ;
@@ -4639,7 +4605,6 @@ fn collect_item(ccx: @crate_ctxt, abi: @mutable option<ast::native_abi>,
4639
4605
// ty_res, which would have to carry around two def_ids otherwise
4640
4606
// -- one to identify the type, and one to find the dtor symbol.
4641
4607
let t = ty:: node_id_to_type ( ccx. tcx , dtor_id) ;
4642
- // FIXME: how to get rid of this check?
4643
4608
register_fn_full ( ccx, i. span , my_path + [ path_name ( "dtor" ) ] ,
4644
4609
"res_dtor" , tps, i. id , t) ;
4645
4610
}
0 commit comments