From fbbdb0fc971a403dd5305af715bf2d0b10e6d5ec Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 31 Jul 2023 19:21:08 +0000 Subject: [PATCH] No need for infer projection hack in add_item_bounds_for_hidden_type --- .../rustc_infer/src/infer/opaque_types.rs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 945136fbff2e9..b91c87c56d414 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -595,23 +595,8 @@ impl<'tcx> InferCtxt<'tcx> { let predicate = predicate.fold_with(&mut BottomUpFolder { tcx, ty_op: |ty| match *ty.kind() { - // We can't normalize associated types from `rustc_infer`, - // but we can eagerly register inference variables for them. - // FIXME(RPITIT): Don't replace RPITITs with inference vars. - // FIXME(inherent_associated_types): Extend this to support `ty::Inherent`, too. - ty::Alias(ty::Projection, projection_ty) - if !projection_ty.has_escaping_bound_vars() - && !tcx.is_impl_trait_in_trait(projection_ty.def_id) - && !self.next_trait_solver() => - { - self.infer_projection( - param_env, - projection_ty, - cause.clone(), - 0, - obligations, - ) - } + // FIXME(inherent_associated_types): Do we need support here for `ty::Inherent`? + // 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, args: args2, .. })