@@ -715,7 +715,6 @@ fn type_of(&@crate_ctxt cx, &span sp, &ty::t t) -> TypeRef {
715
715
cx. sess . span_err ( sp,
716
716
"type_of() called on a type with dynamic size: " +
717
717
ty:: ty_to_str ( cx. tcx , t) ) ;
718
- fail;
719
718
}
720
719
721
720
ret type_of_inner ( cx, sp, t) ;
@@ -937,14 +936,14 @@ fn type_of_inner(&@crate_ctxt cx, &span sp, &ty::t t) -> TypeRef {
937
936
llty = abs_pair;
938
937
}
939
938
case ( ty:: ty_var ( _) ) {
940
- cx. tcx . sess . span_err ( sp, "ty_var in trans::type_of" ) ;
939
+ cx. tcx . sess . span_err ( sp, "trans::type_of called on ty_var " ) ;
941
940
}
942
941
case ( ty:: ty_param ( _) ) {
943
942
llty = T_i8 ( ) ;
944
943
}
945
944
case ( ty:: ty_bound_param ( _) ) {
946
- log_err "ty_bound_param in trans::type_of" ;
947
- fail ;
945
+ cx . tcx . sess . span_err ( sp ,
946
+ "trans::type_of called on ty_bound_param" ) ;
948
947
}
949
948
case ( ty:: ty_type) { llty = T_ptr ( T_tydesc ( cx. tn ) ) ; }
950
949
}
@@ -1212,21 +1211,12 @@ fn find_scope_cx(&@block_ctxt cx) -> @block_ctxt {
1212
1211
be find_scope_cx ( b) ;
1213
1212
}
1214
1213
case ( parent_none) {
1215
- fail;
1214
+ cx. fcx . lcx . ccx . sess . bug ( "trans::find_scope_cx() "
1215
+ + "called on parentless block_ctxt" ) ;
1216
1216
}
1217
1217
}
1218
- }
1219
1218
1220
- fn find_outer_scope_cx ( & @block_ctxt cx ) -> @block_ctxt {
1221
- auto scope_cx = find_scope_cx ( cx) ;
1222
- alt ( cx. parent ) {
1223
- case ( parent_some ( ?b) ) {
1224
- be find_scope_cx ( b) ;
1225
- }
1226
- case ( parent_none) {
1227
- fail;
1228
- }
1229
- }
1219
+ fail; // fools the return-checker
1230
1220
}
1231
1221
1232
1222
fn umax ( & @block_ctxt cx , ValueRef a, ValueRef b) -> ValueRef {
@@ -1320,8 +1310,8 @@ fn simplify_type(&@crate_ctxt ccx, &ty::t typ) -> ty::t {
1320
1310
// Computes the size of the data part of a non-dynamically-sized tag.
1321
1311
fn static_size_of_tag( & @crate_ctxt cx , & span sp, & ty:: t t) -> uint {
1322
1312
if ( ty:: type_has_dynamic_size ( cx. tcx , t) ) {
1323
- log_err "dynamically sized type passed to static_size_of_tag()" ;
1324
- fail ;
1313
+ cx . tcx . sess . span_err ( sp , "dynamically sized type passed to "
1314
+ + "static_size_of_tag()" ) ;
1325
1315
}
1326
1316
1327
1317
if ( cx. tag_sizes . contains_key ( t) ) {
@@ -1336,8 +1326,8 @@ fn static_size_of_tag(&@crate_ctxt cx, &span sp, &ty::t t) -> uint {
1336
1326
subtys = subtys_;
1337
1327
}
1338
1328
case ( _) {
1339
- log_err "non-tag passed to static_size_of_tag()" ;
1340
- fail ;
1329
+ cx . tcx . sess . span_err ( sp , "non-tag passed to "
1330
+ + "static_size_of_tag()" ) ;
1341
1331
}
1342
1332
}
1343
1333
@@ -2570,7 +2560,8 @@ fn make_scalar_cmp_glue(&@block_ctxt cx, ValueRef lhs, ValueRef rhs,
2570
2560
}
2571
2561
case ( _) {
2572
2562
// Should never get here, because t is scalar.
2573
- fail;
2563
+ cx. fcx . lcx . ccx . sess . bug ( "non-scalar type passed to "
2564
+ + "make_scalar_cmp_glue" ) ;
2574
2565
}
2575
2566
}
2576
2567
}
@@ -2812,7 +2803,6 @@ fn iter_structural_ty_full(&@block_ctxt cx,
2812
2803
j += 1 ;
2813
2804
}
2814
2805
}
2815
- case ( _) { fail; }
2816
2806
}
2817
2807
2818
2808
variant_cx. build. Br ( next_cx. llbb) ;
@@ -2984,7 +2974,6 @@ fn iter_sequence(@block_ctxt cx,
2984
2974
cx. fcx. lcx. ccx. sess. bug( "unexpected type in " +
2985
2975
"trans:: iter_sequence: " +
2986
2976
ty:: ty_to_str( cx. fcx. lcx. ccx. tcx, t) ) ;
2987
- fail;
2988
2977
}
2989
2978
}
2990
2979
}
@@ -3329,7 +3318,6 @@ fn copy_val(&@block_ctxt cx,
3329
3318
3330
3319
cx. fcx. lcx. ccx. sess. bug( "unexpected type in trans:: copy_val: " +
3331
3320
ty:: ty_to_str( cx. fcx. lcx. ccx. tcx, t) ) ;
3332
- fail;
3333
3321
}
3334
3322
3335
3323
// This works like copy_val, except that it deinitializes the source.
@@ -3367,7 +3355,6 @@ fn move_val(&@block_ctxt cx,
3367
3355
3368
3356
cx. fcx. lcx. ccx. sess. bug( "unexpected type in trans:: move_val: " +
3369
3357
ty:: ty_to_str( cx. fcx. lcx. ccx. tcx, t) ) ;
3370
- fail;
3371
3358
}
3372
3359
3373
3360
@@ -3490,12 +3477,11 @@ fn trans_unary(&@block_ctxt cx, ast::unop op,
3490
3477
ret res( sub. bcx, box) ;
3491
3478
}
3492
3479
case ( ast:: deref) {
3493
- log_err "deref expressions should have been translated using " +
3494
- " trans_lval( ) , not trans_unary ( ) " ;
3495
- fail ;
3480
+ cx . fcx . lcx . ccx . sess . bug ( "deref expressions should have been "
3481
+ + "translated using trans_lval( ) , not "
3482
+ + "trans_unary ( ) " ) ;
3496
3483
}
3497
3484
}
3498
- fail;
3499
3485
}
3500
3486
3501
3487
fn trans_compare( & @block_ctxt cx0, ast:: binop op, & ty:: t t0,
@@ -3659,7 +3645,6 @@ fn trans_eager_binop(&@block_ctxt cx, ast::binop op, &ty::t intype,
3659
3645
ret trans_compare( cx, op, intype, lhs, rhs) ;
3660
3646
}
3661
3647
}
3662
- fail;
3663
3648
}
3664
3649
3665
3650
fn autoderef( & @block_ctxt cx, ValueRef v, & ty:: t t) -> result {
@@ -3783,7 +3768,6 @@ fn trans_binary(&@block_ctxt cx, ast::binop op,
3783
3768
autoderefed_ty( cx. fcx. lcx. ccx, lhty) , lhs. val, rhs. val) ;
3784
3769
}
3785
3770
}
3786
- fail;
3787
3771
}
3788
3772
3789
3773
fn join_results( & @block_ctxt parent_cx,
@@ -4211,7 +4195,6 @@ fn trans_for_each(&@block_ctxt cx,
4211
4195
ret res( r. bcx , C_nil ( ) ) ;
4212
4196
}
4213
4197
}
4214
- fail;
4215
4198
}
4216
4199
4217
4200
@@ -4325,8 +4308,6 @@ fn trans_pat_match(&@block_ctxt cx, &@ast::pat pat, ValueRef llval,
4325
4308
ret res( matched_cx, llval) ;
4326
4309
}
4327
4310
}
4328
-
4329
- fail;
4330
4311
}
4331
4312
4332
4313
fn trans_pat_binding( & @block_ctxt cx, & @ast:: pat pat,
@@ -4650,7 +4631,6 @@ fn trans_field(&@block_ctxt cx, &span sp, ValueRef v, &ty::t t0,
4650
4631
}
4651
4632
case ( _) { cx. fcx. lcx. ccx. sess. unimpl( "field variant in trans_field" ) ; }
4652
4633
}
4653
- fail;
4654
4634
}
4655
4635
4656
4636
fn trans_index( & @block_ctxt cx, & span sp, & @ast:: expr base,
@@ -4747,7 +4727,9 @@ fn trans_lval(&@block_ctxt cx, &@ast::expr e) -> lval_result {
4747
4727
}
4748
4728
case ( _) {
4749
4729
// Shouldn't happen.
4750
- fail;
4730
+ cx. fcx . lcx . ccx . sess . bug (
4731
+ "trans_lval called on expr_self_method in a context"
4732
+ + "without llself" ) ;
4751
4733
}
4752
4734
4753
4735
}
@@ -4758,7 +4740,6 @@ fn trans_lval(&@block_ctxt cx, &@ast::expr e) -> lval_result {
4758
4740
+ pretty:: pprust:: expr_to_str ( e) ) ;
4759
4741
}
4760
4742
}
4761
- fail;
4762
4743
}
4763
4744
4764
4745
fn int_cast ( & @block_ctxt bcx , TypeRef lldsttype , TypeRef llsrctype ,
@@ -5898,7 +5879,6 @@ fn trans_log(int lvl, &@block_ctxt cx, &@ast::expr e) -> result {
5898
5879
cx. fcx. lcx. ccx. sess. span_err( e. span,
5899
5880
"log called on unsupported type " +
5900
5881
ty:: ty_to_str( cx. fcx. lcx. ccx. tcx, e_ty) ) ;
5901
- fail;
5902
5882
}
5903
5883
}
5904
5884
}
@@ -6017,7 +5997,9 @@ fn trans_break_cont(&@block_ctxt cx, bool to_end) -> result {
6017
5997
}
6018
5998
}
6019
5999
}
6020
- fail;
6000
+
6001
+ // If we get here without returning, it's a bug
6002
+ cx. fcx. lcx. ccx. sess. bug( "in trans::trans_break_cont()" ) ;
6021
6003
}
6022
6004
6023
6005
fn trans_break( & @block_ctxt cx) -> result {
@@ -6085,7 +6067,6 @@ fn trans_port(&@block_ctxt cx, &ast::ann ann) -> result {
6085
6067
}
6086
6068
case ( _) {
6087
6069
cx. fcx. lcx. ccx. sess. bug( "non-port type in trans_port" ) ;
6088
- fail;
6089
6070
}
6090
6071
}
6091
6072
@@ -6310,7 +6291,6 @@ fn trans_send(&@block_ctxt cx, &@ast::expr lhs, &@ast::expr rhs,
6310
6291
}
6311
6292
case ( _) {
6312
6293
bcx. fcx . lcx . ccx . sess . bug ( "non-chan type in trans_send" ) ;
6313
- fail;
6314
6294
}
6315
6295
}
6316
6296
@@ -6432,7 +6412,6 @@ fn trans_anon_obj(&@block_ctxt cx, &span sp,
6432
6412
// TODO: everything else.
6433
6413
6434
6414
cx. fcx . lcx . ccx . sess . unimpl ( "support for anonymous objects" ) ;
6435
- fail;
6436
6415
}
6437
6416
6438
6417
fn init_local ( & @block_ctxt cx , & @ast:: local local) -> result {
@@ -6917,7 +6896,6 @@ fn arg_tys_of_fn(&@crate_ctxt ccx, ast::ann ann) -> vec[ty::arg] {
6917
6896
ret arg_tys;
6918
6897
}
6919
6898
}
6920
- fail;
6921
6899
}
6922
6900
6923
6901
fn ret_ty_of_fn_ty ( & @crate_ctxt ccx , ty:: t t) -> ty:: t {
@@ -6926,7 +6904,6 @@ fn ret_ty_of_fn_ty(&@crate_ctxt ccx, ty::t t) -> ty::t {
6926
6904
ret ret_ty;
6927
6905
}
6928
6906
}
6929
- fail;
6930
6907
}
6931
6908
6932
6909
@@ -7515,7 +7492,6 @@ fn decl_fn_and_pair(&@crate_ctxt ccx, &span sp,
7515
7492
}
7516
7493
case ( _) {
7517
7494
ccx. sess. bug( "decl_fn_and_pair(): fn item doesn't have fn type!" ) ;
7518
- fail;
7519
7495
}
7520
7496
}
7521
7497
@@ -7558,7 +7534,6 @@ fn native_fn_ty_param_count(&@crate_ctxt cx, &ast::def_id id) -> uint {
7558
7534
case ( ast:: native_item_ty( _, _) ) {
7559
7535
cx. sess. bug( "decl_native_fn_and_pair(): native fn isn't " +
7560
7536
"actually a fn?!" ) ;
7561
- fail;
7562
7537
}
7563
7538
case ( ast:: native_item_fn( _, _, _, ?tps, _, _) ) {
7564
7539
count = vec:: len[ ast:: ty_param] ( tps) ;
@@ -7574,7 +7549,6 @@ fn native_fn_wrapper_type(&@crate_ctxt cx, &span sp, uint ty_param_count,
7574
7549
ret type_of_fn( cx, sp, ast:: proto_fn, args, out, ty_param_count) ;
7575
7550
}
7576
7551
}
7577
- fail;
7578
7552
}
7579
7553
7580
7554
fn decl_native_fn_and_pair( & @crate_ctxt ccx,
@@ -8013,7 +7987,6 @@ fn find_main_fn(&@crate_ctxt cx) -> ValueRef {
8013
7987
cx. sess . err ( "multiple main fns found" ) ;
8014
7988
}
8015
7989
}
8016
- fail;
8017
7990
}
8018
7991
8019
7992
fn trans_main_fn ( @local_ctxt cx , ValueRef crate_map ) {
0 commit comments