Reuse ErrorGuaranteed during relation

This commit is contained in:
Michael Goulet 2022-12-30 21:51:12 +00:00
parent ef4046e4f3
commit 4e30ad8d60
2 changed files with 4 additions and 2 deletions

View File

@ -89,7 +89,9 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
Err(TypeError::Sorts(relate::expected_found(self, a, b)))
}
(&ty::Error(_), _) | (_, &ty::Error(_)) => Ok(self.tcx().ty_error()),
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => {
Ok(self.tcx().ty_error_with_guaranteed(guar))
}
_ => relate::super_relate_tys(self, a, b),
}

View File

@ -414,7 +414,7 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
bug!("bound types encountered in super_relate_tys")
}
(&ty::Error(_), _) | (_, &ty::Error(_)) => Ok(tcx.ty_error()),
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(tcx.ty_error_with_guaranteed(guar)),
(&ty::Never, _)
| (&ty::Char, _)