@@ -120,10 +120,10 @@ fn make_invalid_casting_error<'a, 'gcx, 'tcx>(sess: &'a Session,
120
120
cast_ty : Ty < ' tcx > ,
121
121
fcx : & FnCtxt < ' a , ' gcx , ' tcx > )
122
122
-> DiagnosticBuilder < ' a > {
123
- struct_span_err ! ( sess, span, E0606 ,
124
- "casting `{}` as `{}` is invalid" ,
125
- fcx. ty_to_string( expr_ty) ,
126
- fcx. ty_to_string( cast_ty) )
123
+ type_error_struct ! ( sess, span, expr_ty , E0606 ,
124
+ "casting `{}` as `{}` is invalid" ,
125
+ fcx. ty_to_string( expr_ty) ,
126
+ fcx. ty_to_string( cast_ty) )
127
127
}
128
128
129
129
impl < ' a , ' gcx , ' tcx > CastCheck < ' tcx > {
@@ -212,11 +212,11 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
212
212
. emit ( ) ;
213
213
}
214
214
CastError :: CastToChar => {
215
- struct_span_err ! ( fcx. tcx. sess, self . span, E0604 ,
215
+ type_error_struct ! ( fcx. tcx. sess, self . span, self . expr_ty , E0604 ,
216
216
"only `u8` can be cast as `char`, not `{}`" , self . expr_ty) . emit ( ) ;
217
217
}
218
218
CastError :: NonScalar => {
219
- struct_span_err ! ( fcx. tcx. sess, self . span, E0605 ,
219
+ type_error_struct ! ( fcx. tcx. sess, self . span, self . expr_ty , E0605 ,
220
220
"non-primitive cast: `{}` as `{}`" ,
221
221
self . expr_ty,
222
222
fcx. ty_to_string( self . cast_ty) )
@@ -225,7 +225,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
225
225
. emit ( ) ;
226
226
}
227
227
CastError :: SizedUnsizedCast => {
228
- struct_span_err ! ( fcx. tcx. sess, self . span, E0607 ,
228
+ type_error_struct ! ( fcx. tcx. sess, self . span, self . expr_ty , E0607 ,
229
229
"cannot cast thin pointer `{}` to fat pointer `{}`" ,
230
230
self . expr_ty,
231
231
fcx. ty_to_string( self . cast_ty) ) . emit ( ) ;
0 commit comments