diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 84452979aa58..73627a818e5d 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -576,7 +576,6 @@ fn find_and_apply_rpit_args<'tcx>( struct Visitor<'tcx> { tcx: TyCtxt<'tcx>, opaque: DefId, - function: DefId, seen: FxHashSet, } impl<'tcx> ty::TypeVisitor> for Visitor<'tcx> { @@ -601,19 +600,6 @@ fn find_and_apply_rpit_args<'tcx>( } } } - ty::Alias(ty::Projection, alias) => { - if self.tcx.is_impl_trait_in_trait(alias.def_id) - && self.tcx.impl_trait_in_trait_parent_fn(alias.def_id) == self.function - { - // If we're lowering to associated item, install the opaque type which is just - // the `type_of` of the trait's associated item. If we're using the old lowering - // strategy, then just reinterpret the associated type like an opaque :^) - self.tcx - .type_of(alias.def_id) - .instantiate(self.tcx, alias.args) - .visit_with(self)?; - } - } ty::Alias(ty::Weak, alias) => { self.tcx .type_of(alias.def_id) @@ -627,7 +613,7 @@ fn find_and_apply_rpit_args<'tcx>( } } if let ControlFlow::Break(args) = - ret.visit_with(&mut Visitor { tcx, function, opaque, seen: Default::default() }) + ret.visit_with(&mut Visitor { tcx, opaque, seen: Default::default() }) { trace!(?args); trace!("expected: {hidden_ty:#?}"); diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index 119ed2fa4082..d5f03a6aaed1 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -558,10 +558,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { let pred = clause.kind().rebind(match clause.kind().skip_binder() { ty::ClauseKind::Trait(trait_pred) => { - // FIXME(rpitit): This will need to be fixed when we move to associated types assert!(matches!( *trait_pred.trait_ref.self_ty().kind(), - ty::Alias(_, ty::AliasTy { def_id, args: alias_args, .. }) + ty::Alias(ty::Opaque, ty::AliasTy { def_id, args: alias_args, .. }) if def_id == rpit_def_id && args == alias_args )); ty::ClauseKind::Trait(trait_pred.with_self_ty(self.tcx, ty)) @@ -569,7 +568,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty::ClauseKind::Projection(mut proj_pred) => { assert!(matches!( *proj_pred.projection_ty.self_ty().kind(), - ty::Alias(_, ty::AliasTy { def_id, args: alias_args, .. }) + ty::Alias(ty::Opaque, ty::AliasTy { def_id, args: alias_args, .. }) if def_id == rpit_def_id && args == alias_args )); proj_pred = proj_pred.with_self_ty(self.tcx, ty); diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index ca3b595d238e..0624a4baf79d 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -723,11 +723,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .iter_instantiated_copied(self.tcx, args) .find_map(|(p, s)| get_future_output(p.as_predicate(), s))?, ty::Error(_) => return None, - ty::Alias(ty::Projection, proj) if self.tcx.is_impl_trait_in_trait(proj.def_id) => self - .tcx - .explicit_item_bounds(proj.def_id) - .iter_instantiated_copied(self.tcx, proj.args) - .find_map(|(p, s)| get_future_output(p.as_predicate(), s))?, _ => span_bug!( self.tcx.def_span(expr_def_id), "async fn generator return type not an inference variable: {ret_ty}" diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 945136fbff2e..9c90b7045862 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -619,13 +619,6 @@ impl<'tcx> InferCtxt<'tcx> { { hidden_ty } - // FIXME(RPITIT): This can go away when we move to associated types - // FIXME(inherent_associated_types): Extend this to support `ty::Inherent`, too. - ty::Alias(ty::Projection, ty::AliasTy { def_id: def_id2, args: args2, .. }) - if def_id == def_id2 && args == args2 => - { - hidden_ty - } _ => ty, }, lt_op: |lt| lt,