@@ -302,9 +302,8 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
302
302
// non-empty body, explicit discriminants should have
303
303
// been rejected by a checker before this point.
304
304
if !cases. iter ( ) . enumerate ( ) . all ( |( i, c) | c. discr == Disr :: from ( i) ) {
305
- cx. sess ( ) . bug ( & format ! ( "non-C-like enum {} with specified \
306
- discriminants",
307
- cx. tcx( ) . item_path_str( def. did) ) ) ;
305
+ bug ! ( "non-C-like enum {} with specified discriminants" ,
306
+ cx. tcx( ) . item_path_str( def. did) ) ;
308
307
}
309
308
310
309
if cases. len ( ) == 1 {
@@ -430,7 +429,7 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
430
429
431
430
General ( ity, fields, dtor_to_init_u8 ( dtor) )
432
431
}
433
- _ => cx . sess ( ) . bug ( & format ! ( "adt::represent_type called on non-ADT type: {}" , t) )
432
+ _ => bug ! ( "adt::represent_type called on non-ADT type: {}" , t)
434
433
}
435
434
}
436
435
@@ -615,7 +614,7 @@ fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntTyp
615
614
match hint {
616
615
attr:: ReprInt ( span, ity) => {
617
616
if !bounds_usable ( cx, ity, bounds) {
618
- cx . sess ( ) . span_bug ( span, "representation hint insufficient for discriminant range" )
617
+ span_bug ! ( span, "representation hint insufficient for discriminant range" )
619
618
}
620
619
return ity;
621
620
}
@@ -632,10 +631,10 @@ fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntTyp
632
631
attempts = choose_shortest;
633
632
} ,
634
633
attr:: ReprPacked => {
635
- cx . tcx ( ) . sess . bug ( "range_to_inttype: found ReprPacked on an enum" ) ;
634
+ bug ! ( "range_to_inttype: found ReprPacked on an enum" ) ;
636
635
}
637
636
attr:: ReprSimd => {
638
- cx . tcx ( ) . sess . bug ( "range_to_inttype: found ReprSimd on an enum" ) ;
637
+ bug ! ( "range_to_inttype: found ReprSimd on an enum" ) ;
639
638
}
640
639
}
641
640
for & ity in attempts {
@@ -835,7 +834,7 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
835
834
Type :: array ( & Type :: i64 ( cx) , align_units) ,
836
835
a if a. count_ones ( ) == 1 => Type :: array ( & Type :: vector ( & Type :: i32 ( cx) , a / 4 ) ,
837
836
align_units) ,
838
- _ => panic ! ( "unsupported enum alignment: {}" , align)
837
+ _ => bug ! ( "unsupported enum alignment: {}" , align)
839
838
} ;
840
839
assert_eq ! ( machine:: llalign_of_min( cx, fill_ty) , align) ;
841
840
assert_eq ! ( padded_discr_size % discr_size, 0 ) ; // Ensure discr_ty can fill pad evenly
@@ -984,7 +983,7 @@ pub fn trans_case<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr, discr: Disr)
984
983
C_integral ( ll_inttype ( bcx. ccx ( ) , ity) , discr. 0 , true )
985
984
}
986
985
Univariant ( ..) => {
987
- bcx . ccx ( ) . sess ( ) . bug ( "no cases for univariants or structs" )
986
+ bug ! ( "no cases for univariants or structs" )
988
987
}
989
988
RawNullablePointer { .. } |
990
989
StructWrappedNullablePointer { .. } => {
@@ -1088,7 +1087,7 @@ pub fn trans_field_ptr_builder<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>,
1088
1087
// someday), it will need to return a possibly-new bcx as well.
1089
1088
match * r {
1090
1089
CEnum ( ..) => {
1091
- bcx . ccx ( ) . sess ( ) . bug ( "element access in C-like enum" )
1090
+ bug ! ( "element access in C-like enum" )
1092
1091
}
1093
1092
Univariant ( ref st, _dtor) => {
1094
1093
assert_eq ! ( discr, Disr ( 0 ) ) ;
@@ -1279,7 +1278,7 @@ pub fn fold_variants<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
1279
1278
1280
1279
bcx_next
1281
1280
}
1282
- _ => unreachable ! ( )
1281
+ _ => bug ! ( )
1283
1282
}
1284
1283
}
1285
1284
@@ -1319,7 +1318,7 @@ pub fn trans_drop_flag_ptr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
1319
1318
fcx. pop_custom_cleanup_scope ( custom_cleanup_scope) ;
1320
1319
datum:: DatumBlock :: new ( bcx, expr_datum)
1321
1320
}
1322
- _ => bcx . ccx ( ) . sess ( ) . bug ( "tried to get drop flag of non-droppable type" )
1321
+ _ => bug ! ( "tried to get drop flag of non-droppable type" )
1323
1322
}
1324
1323
}
1325
1324
@@ -1478,7 +1477,7 @@ pub fn const_get_discrim(r: &Repr, val: ValueRef) -> Disr {
1478
1477
}
1479
1478
Univariant ( ..) => Disr ( 0 ) ,
1480
1479
RawNullablePointer { .. } | StructWrappedNullablePointer { .. } => {
1481
- unreachable ! ( "const discrim access of non c-like enum" )
1480
+ bug ! ( "const discrim access of non c-like enum" )
1482
1481
}
1483
1482
}
1484
1483
}
@@ -1488,10 +1487,10 @@ pub fn const_get_discrim(r: &Repr, val: ValueRef) -> Disr {
1488
1487
///
1489
1488
/// (Not to be confused with `common::const_get_elt`, which operates on
1490
1489
/// raw LLVM-level structs and arrays.)
1491
- pub fn const_get_field ( ccx : & CrateContext , r : & Repr , val : ValueRef ,
1492
- _discr : Disr , ix : usize ) -> ValueRef {
1490
+ pub fn const_get_field ( r : & Repr , val : ValueRef , _discr : Disr ,
1491
+ ix : usize ) -> ValueRef {
1493
1492
match * r {
1494
- CEnum ( ..) => ccx . sess ( ) . bug ( "element access in C-like enum const" ) ,
1493
+ CEnum ( ..) => bug ! ( "element access in C-like enum const" ) ,
1495
1494
Univariant ( ..) => const_struct_field ( val, ix) ,
1496
1495
General ( ..) => const_struct_field ( val, ix + 1 ) ,
1497
1496
RawNullablePointer { .. } => {
0 commit comments