Rollup merge of #135816 - BoxyUwU:root_normalizes_to_goal_ice, r=lcnr
Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors r? `@lcnr` I added `structurally_normalize_term` so that code that is generic over ty or const can use the structurally normalize helpers. See `tests/ui/traits/next-solver/diagnostics/alias_relate_error_uses_structurally_normalize.rs` for a description of the reason for the (now fixed) ICEs
This commit is contained in:
commit
ef0e6863c6
27 changed files with 267 additions and 121 deletions
|
@ -86,7 +86,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
|
|||
if self.infcx.next_trait_solver()
|
||||
&& let ty::Alias(..) = ty.kind()
|
||||
{
|
||||
let (normalized_ty, obligations) = self.structurally_normalize(ty)?;
|
||||
let (normalized_ty, obligations) = self.structurally_normalize_ty(ty)?;
|
||||
self.state.obligations.extend(obligations);
|
||||
(AutoderefKind::Builtin, normalized_ty)
|
||||
} else {
|
||||
|
@ -166,7 +166,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
|||
}
|
||||
|
||||
let (normalized_ty, obligations) =
|
||||
self.structurally_normalize(Ty::new_projection(tcx, trait_target_def_id, [ty]))?;
|
||||
self.structurally_normalize_ty(Ty::new_projection(tcx, trait_target_def_id, [ty]))?;
|
||||
debug!("overloaded_deref_ty({:?}) = ({:?}, {:?})", ty, normalized_ty, obligations);
|
||||
self.state.obligations.extend(obligations);
|
||||
|
||||
|
@ -174,12 +174,12 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
|||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
pub fn structurally_normalize(
|
||||
pub fn structurally_normalize_ty(
|
||||
&self,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Option<(Ty<'tcx>, PredicateObligations<'tcx>)> {
|
||||
let ocx = ObligationCtxt::new(self.infcx);
|
||||
let Ok(normalized_ty) = ocx.structurally_normalize(
|
||||
let Ok(normalized_ty) = ocx.structurally_normalize_ty(
|
||||
&traits::ObligationCause::misc(self.span, self.body_id),
|
||||
self.param_env,
|
||||
ty,
|
||||
|
|
|
@ -320,7 +320,7 @@ fn orphan_check<'tcx>(
|
|||
}
|
||||
|
||||
let ty = if infcx.next_trait_solver() {
|
||||
ocx.structurally_normalize(
|
||||
ocx.structurally_normalize_ty(
|
||||
&cause,
|
||||
ty::ParamEnv::empty(),
|
||||
infcx.resolve_vars_if_possible(ty),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue