X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_typeck%2Fsrc%2F_match.rs;h=ab12cae4e2b08a0b48fc57e8b687f841b7b59509;hb=a8847df167c5851caf8f465354fc3d73b7e9338c;hp=e25a9e9036a15607e6b2000aac8c03f8281eaa63;hpb=7dbd1603b873527cbce2ac3f289f271b138cfc68;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index e25a9e9036a..ab12cae4e2b 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -212,7 +212,7 @@ fn suggest_removing_semicolon_for_coerce( self.can_coerce(arm_ty, ret_ty) && prior_arm.map_or(true, |(_, ty, _)| self.can_coerce(ty, ret_ty)) // The match arms need to unify for the case of `impl Trait`. - && !matches!(ret_ty.kind(), ty::Opaque(..)) + && !matches!(ret_ty.kind(), ty::Alias(ty::Opaque, ..)) } _ => false, }; @@ -518,7 +518,7 @@ pub(crate) fn opt_suggest_box_span( let substs = sig.output().walk().find_map(|arg| { if let ty::GenericArgKind::Type(ty) = arg.unpack() - && let ty::Opaque(def_id, substs) = *ty.kind() + && let ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) = *ty.kind() && def_id == rpit_def_id { Some(substs) @@ -542,15 +542,12 @@ pub(crate) fn opt_suggest_box_span( ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => { assert_eq!(trait_pred.trait_ref.self_ty(), opaque_ty); ty::PredicateKind::Clause(ty::Clause::Trait( - trait_pred.with_self_type(self.tcx, ty), + trait_pred.with_self_ty(self.tcx, ty), )) } ty::PredicateKind::Clause(ty::Clause::Projection(mut proj_pred)) => { assert_eq!(proj_pred.projection_ty.self_ty(), opaque_ty); - proj_pred.projection_ty.substs = self.tcx.mk_substs_trait( - ty, - proj_pred.projection_ty.substs.iter().skip(1), - ); + proj_pred = proj_pred.with_self_ty(self.tcx, ty); ty::PredicateKind::Clause(ty::Clause::Projection(proj_pred)) } _ => continue,