Skip to content

Commit 9137153

Browse files
Use new macro instead
1 parent deb1eb6 commit 9137153

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/librustc_typeck/check/cast.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ fn make_invalid_casting_error<'a, 'gcx, 'tcx>(sess: &'a Session,
120120
cast_ty: Ty<'tcx>,
121121
fcx: &FnCtxt<'a, 'gcx, 'tcx>)
122122
-> 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))
127127
}
128128

129129
impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
@@ -212,11 +212,11 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
212212
.emit();
213213
}
214214
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,
216216
"only `u8` can be cast as `char`, not `{}`", self.expr_ty).emit();
217217
}
218218
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,
220220
"non-primitive cast: `{}` as `{}`",
221221
self.expr_ty,
222222
fcx.ty_to_string(self.cast_ty))
@@ -225,7 +225,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
225225
.emit();
226226
}
227227
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,
229229
"cannot cast thin pointer `{}` to fat pointer `{}`",
230230
self.expr_ty,
231231
fcx.ty_to_string(self.cast_ty)).emit();

0 commit comments

Comments
 (0)