1
Fork 0

change is_subtype to relate_types

This commit is contained in:
ouz-a 2023-09-30 13:44:31 +03:00
parent cd7f471931
commit 6f0c5ee2d4
15 changed files with 128 additions and 86 deletions

View file

@ -716,14 +716,11 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
}
PlaceTy::from_ty(fty)
}
ProjectionElem::Subtype(_) => {
let guard = span_mirbug_and_err!(
self,
place,
"ProjectionElem::Subtype shouldn't exist in borrowck"
);
PlaceTy::from_ty(Ty::new_error(tcx, guard))
}
ProjectionElem::Subtype(_) => PlaceTy::from_ty(Ty::new_error_with_message(
tcx,
self.last_span,
"ProjectionElem::Subtype shouldn't exist in borrowck",
)),
ProjectionElem::OpaqueCast(ty) => {
let ty = self.sanitize_type(place, ty);
let ty = self.cx.normalize(ty, location);
@ -2564,7 +2561,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
}
}
ProjectionElem::Field(..)
| ProjectionElem::Subtype(..)
| ProjectionElem::Downcast(..)
| ProjectionElem::OpaqueCast(..)
| ProjectionElem::Index(..)
@ -2572,6 +2568,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
| ProjectionElem::Subslice { .. } => {
// other field access
}
ProjectionElem::Subtype(_) => {
bug!("ProjectionElem::Subtype shouldn't exist in borrowck")
}
}
}
}