Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds
This commit is contained in:
parent
18a6d911ca
commit
2e8af07a8a
5 changed files with 39 additions and 13 deletions
|
@ -536,7 +536,8 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
)?;
|
||||
|
||||
self.add_item_bounds_for_hidden_type(
|
||||
opaque_type_key,
|
||||
opaque_type_key.def_id.to_def_id(),
|
||||
opaque_type_key.substs,
|
||||
cause,
|
||||
param_env,
|
||||
hidden_ty,
|
||||
|
@ -598,7 +599,8 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
|
||||
pub fn add_item_bounds_for_hidden_type(
|
||||
&self,
|
||||
OpaqueTypeKey { def_id, substs }: OpaqueTypeKey<'tcx>,
|
||||
def_id: DefId,
|
||||
substs: ty::SubstsRef<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
hidden_ty: Ty<'tcx>,
|
||||
|
@ -631,7 +633,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
// Replace all other mentions of the same opaque type with the hidden type,
|
||||
// as the bounds must hold on the hidden type after all.
|
||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def_id2, substs: substs2, .. })
|
||||
if def_id.to_def_id() == def_id2 && substs == substs2 =>
|
||||
if def_id == def_id2 && substs == substs2 =>
|
||||
{
|
||||
hidden_ty
|
||||
}
|
||||
|
@ -640,7 +642,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
ty::Alias(
|
||||
ty::Projection,
|
||||
ty::AliasTy { def_id: def_id2, substs: substs2, .. },
|
||||
) if def_id.to_def_id() == def_id2 && substs == substs2 => hidden_ty,
|
||||
) if def_id == def_id2 && substs == substs2 => hidden_ty,
|
||||
_ => ty,
|
||||
},
|
||||
lt_op: |lt| lt,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue