@@ -8,14 +8,14 @@ use rspirv::spirv::{StorageClass, Word};
8
8
use rustc_data_structures:: fx:: FxHashMap ;
9
9
use rustc_errors:: ErrorReported ;
10
10
use rustc_index:: vec:: Idx ;
11
- use rustc_middle:: bug;
12
11
use rustc_middle:: ty:: layout:: { FnAbiOf , LayoutOf , TyAndLayout } ;
13
12
use rustc_middle:: ty:: query:: Providers ;
14
13
use rustc_middle:: ty:: subst:: SubstsRef ;
15
14
use rustc_middle:: ty:: {
16
15
self , Const , FloatTy , GeneratorSubsts , IntTy , ParamEnv , PolyFnSig , Ty , TyCtxt , TyKind ,
17
16
TypeAndMut , UintTy ,
18
17
} ;
18
+ use rustc_middle:: { bug, span_bug} ;
19
19
use rustc_span:: def_id:: DefId ;
20
20
use rustc_span:: Span ;
21
21
use rustc_span:: DUMMY_SP ;
@@ -152,7 +152,9 @@ impl<'tcx> RecursivePointeeCache<'tcx> {
152
152
) -> Word {
153
153
match self . map . borrow_mut ( ) . entry ( pointee) {
154
154
// We should have hit begin() on this type already, which always inserts an entry.
155
- Entry :: Vacant ( _) => bug ! ( "RecursivePointeeCache::end should always have entry" ) ,
155
+ Entry :: Vacant ( _) => {
156
+ span_bug ! ( span, "RecursivePointeeCache::end should always have entry" )
157
+ }
156
158
Entry :: Occupied ( mut entry) => match * entry. get ( ) {
157
159
// State: There have been no recursive references to this type while defining it, and so no
158
160
// OpTypeForwardPointer has been emitted. This is the most common case.
@@ -174,7 +176,7 @@ impl<'tcx> RecursivePointeeCache<'tcx> {
174
176
. def_with_id ( cx, span, id)
175
177
}
176
178
PointeeDefState :: Defined ( _) => {
177
- bug ! ( "RecursivePointeeCache::end defined pointer twice" )
179
+ span_bug ! ( span , "RecursivePointeeCache::end defined pointer twice" )
178
180
}
179
181
} ,
180
182
}
@@ -466,7 +468,11 @@ pub fn scalar_pair_element_backend_type<'tcx>(
466
468
) -> Word {
467
469
let [ a, b] = match & ty. layout . abi {
468
470
Abi :: ScalarPair ( a, b) => [ a, b] ,
469
- other => bug ! ( "scalar_pair_element_backend_type invalid abi: {:?}" , other) ,
471
+ other => span_bug ! (
472
+ span,
473
+ "scalar_pair_element_backend_type invalid abi: {:?}" ,
474
+ other
475
+ ) ,
470
476
} ;
471
477
let offset = match index {
472
478
0 => Size :: ZERO ,
@@ -595,7 +601,8 @@ fn dig_scalar_pointee<'tcx>(
595
601
596
602
fn trans_aggregate < ' tcx > ( cx : & CodegenCx < ' tcx > , span : Span , ty : TyAndLayout < ' tcx > ) -> Word {
597
603
match ty. fields {
598
- FieldsShape :: Primitive => bug ! (
604
+ FieldsShape :: Primitive => span_bug ! (
605
+ span,
599
606
"trans_aggregate called for FieldsShape::Primitive layout {:#?}" ,
600
607
ty
601
608
) ,
@@ -700,7 +707,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
700
707
} else {
701
708
if let TyKind :: Adt ( _, _) = ty. ty . kind ( ) {
702
709
} else {
703
- bug ! ( "Variants::Multiple not TyKind::Adt" ) ;
710
+ span_bug ! ( span , "Variants::Multiple not TyKind::Adt" ) ;
704
711
}
705
712
if i == 0 {
706
713
field_names. push ( "discriminant" . to_string ( ) ) ;
0 commit comments