X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_typeck%2Fsrc%2F_match.rs;h=e3afc117bb2ad8048ed3b53000d5327e8242f72f;hb=7f3af726065d9eaabf93d87f22d97f60cca7a5f1;hp=31432bb6e417005021ce63f5c558e4d29d6ea916;hpb=872631d0f0fadffe3220ab1bd9c8f1f2342341e2;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index 31432bb6e41..e3afc117bb2 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -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::Opaque(ty::OpaqueTy { def_id, substs }) = *ty.kind() && def_id == rpit_def_id { Some(substs) @@ -539,17 +539,19 @@ pub(crate) fn opt_suggest_box_span( .subst_iter_copied(self.tcx, substs) { let pred = pred.kind().rebind(match pred.kind().skip_binder() { - ty::PredicateKind::Trait(trait_pred) => { + ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => { assert_eq!(trait_pred.trait_ref.self_ty(), opaque_ty); - ty::PredicateKind::Trait(trait_pred.with_self_type(self.tcx, ty)) + ty::PredicateKind::Clause(ty::Clause::Trait( + trait_pred.with_self_type(self.tcx, ty), + )) } - ty::PredicateKind::Projection(mut proj_pred) => { + 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), ); - ty::PredicateKind::Projection(proj_pred) + ty::PredicateKind::Clause(ty::Clause::Projection(proj_pred)) } _ => continue, }); @@ -572,8 +574,5 @@ pub(crate) fn opt_suggest_box_span( } fn arms_contain_ref_bindings<'tcx>(arms: &'tcx [hir::Arm<'tcx>]) -> Option { - arms.iter().filter_map(|a| a.pat.contains_explicit_ref_binding()).max_by_key(|m| match *m { - hir::Mutability::Mut => 1, - hir::Mutability::Not => 0, - }) + arms.iter().filter_map(|a| a.pat.contains_explicit_ref_binding()).max() }