X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Fopaque_hidden_inferred_bound.rs;h=03d6f4fd92687f192ac40cbf540209b057bdfeae;hb=4733312e09c04fec3626ea27083da615d1a1df4d;hp=619582c0539b86dd0f3d04d6c09b4c557306f383;hpb=938948ea806bdffdcfe044cbd3e90981ae0cb654;p=rust.git diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs index 619582c0539..03d6f4fd926 100644 --- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs +++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs @@ -74,7 +74,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) { // Liberate bound regions in the predicate since we // don't actually care about lifetimes in this check. let predicate = cx.tcx.liberate_late_bound_regions(def_id, pred.kind()); - let ty::PredicateKind::Projection(proj) = predicate else { + let ty::PredicateKind::Clause(ty::Clause::Projection(proj)) = predicate else { continue; }; // Only check types, since those are the only things that may @@ -108,6 +108,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) { // then we must've taken advantage of the hack in `project_and_unify_types` where // we replace opaques with inference vars. Emit a warning! if !infcx.predicate_must_hold_modulo_regions(&traits::Obligation::new( + cx.tcx, traits::ObligationCause::dummy(), cx.param_env, assoc_pred, @@ -115,12 +116,13 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) { // If it's a trait bound and an opaque that doesn't satisfy it, // then we can emit a suggestion to add the bound. let add_bound = match (proj_term.kind(), assoc_pred.kind().skip_binder()) { - (ty::Opaque(def_id, _), ty::PredicateKind::Trait(trait_pred)) => { - Some(AddBound { - suggest_span: cx.tcx.def_span(*def_id).shrink_to_hi(), - trait_ref: trait_pred.print_modifiers_and_trait_path(), - }) - } + ( + ty::Opaque(def_id, _), + ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)), + ) => Some(AddBound { + suggest_span: cx.tcx.def_span(*def_id).shrink_to_hi(), + trait_ref: trait_pred.print_modifiers_and_trait_path(), + }), _ => None, }; cx.emit_spanned_lint(