From 60be29bec8734e1455e2833b6cc5f5bfc0e39fa2 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 6 Apr 2024 14:45:48 -0300 Subject: [PATCH] Add a debug asserts call to match_projection_projections to ensure invariant --- compiler/rustc_trait_selection/src/traits/select/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index aa4ab9c7ee9c6..5e9a28b5cceac 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1732,6 +1732,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { env_predicate: PolyProjectionPredicate<'tcx>, potentially_unnormalized_candidates: bool, ) -> ProjectionMatchesProjection { + debug_assert_eq!(obligation.predicate.def_id, env_predicate.projection_def_id()); + let mut nested_obligations = Vec::new(); let infer_predicate = self.infcx.instantiate_binder_with_fresh_vars( obligation.cause.span,