- Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), _, cast_ty) => {
- if let Some(TypeAndMut { ty, .. }) = cast_ty.builtin_deref(true) {
- let unsized_ty = self.tcx.struct_tail_erasing_lifetimes(ty, self.param_env);
-
- // Casting/coercing things to slices is fine.
- if let ty::Slice(_) | ty::Str = unsized_ty.kind() {
- return;
- }
- }
-
- self.check_op(ops::UnsizingCast);
+ Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), _, _) => {
+ // Nothing to check here (`check_local_or_return_ty` ensures no trait objects occur
+ // in the type of any local, which also excludes casts).