@@ -9,7 +9,6 @@ use rustc_middle::thir::*;
9
9
use rustc_middle:: ty:: {
10
10
self , CanonicalUserType , CanonicalUserTypeAnnotation , TyCtxt , UserTypeAnnotationIndex ,
11
11
} ;
12
- use rustc_span:: DUMMY_SP ;
13
12
use rustc_target:: abi:: Size ;
14
13
15
14
impl < ' a , ' tcx > Builder < ' a , ' tcx > {
@@ -111,15 +110,15 @@ fn lit_to_mir_constant<'tcx>(
111
110
let LitToConstInput { lit, ty, neg } = lit_input;
112
111
let trunc = |n| {
113
112
let param_ty = ty:: ParamEnv :: reveal_all ( ) . and ( ty) ;
114
- let width = tcx
115
- . layout_of ( param_ty)
116
- . map_err ( |_| {
117
- LitToConstError :: Reported ( tcx. dcx ( ) . span_delayed_bug (
118
- DUMMY_SP ,
119
- format ! ( "couldn't compute width of literal: {:?}" , lit_input. lit) ,
120
- ) )
121
- } ) ?
122
- . size ;
113
+ let width =
114
+ tcx . layout_of ( param_ty)
115
+ . map_err ( |_| {
116
+ LitToConstError :: Reported ( tcx. dcx ( ) . delayed_bug ( format ! (
117
+ "couldn't compute width of literal: {:?}" ,
118
+ lit_input. lit
119
+ ) ) )
120
+ } ) ?
121
+ . size ;
123
122
trace ! ( "trunc {} with size {} and shift {}" , n, width. bits( ) , 128 - width. bits( ) ) ;
124
123
let result = width. truncate ( n) ;
125
124
trace ! ( "trunc result: {}" , result) ;
@@ -158,16 +157,16 @@ fn lit_to_mir_constant<'tcx>(
158
157
}
159
158
( ast:: LitKind :: Float ( n, _) , ty:: Float ( fty) ) => parse_float_into_constval ( * n, * fty, neg)
160
159
. ok_or_else ( || {
161
- LitToConstError :: Reported ( tcx . dcx ( ) . span_delayed_bug (
162
- DUMMY_SP ,
163
- format ! ( "couldn't parse float literal: {:?}" , lit_input. lit) ,
164
- ) )
160
+ LitToConstError :: Reported (
161
+ tcx . dcx ( )
162
+ . delayed_bug ( format ! ( "couldn't parse float literal: {:?}" , lit_input. lit) ) ,
163
+ )
165
164
} ) ?,
166
165
( ast:: LitKind :: Bool ( b) , ty:: Bool ) => ConstValue :: Scalar ( Scalar :: from_bool ( * b) ) ,
167
166
( ast:: LitKind :: Char ( c) , ty:: Char ) => ConstValue :: Scalar ( Scalar :: from_char ( * c) ) ,
168
167
( ast:: LitKind :: Err , _) => {
169
168
return Err ( LitToConstError :: Reported (
170
- tcx. dcx ( ) . span_delayed_bug ( DUMMY_SP , "encountered LitKind::Err during mir build" ) ,
169
+ tcx. dcx ( ) . delayed_bug ( "encountered LitKind::Err during mir build" ) ,
171
170
) ) ;
172
171
}
173
172
_ => return Err ( LitToConstError :: TypeError ) ,
0 commit comments