about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-01-19 15:32:20 +0000
committerMichael Goulet <michael@errs.io>2023-01-19 16:15:28 +0000
commitaee75f25cbfb187f74d2b8453b0d902ad6ced391 (patch)
treeedae5555d96adae873c704bac1ec2cced72c7f2d
parentc9c8e294d2b6fc7c83641476f4986a7bf5e84817 (diff)
downloadrust-aee75f25cbfb187f74d2b8453b0d902ad6ced391.tar.gz
rust-aee75f25cbfb187f74d2b8453b0d902ad6ced391.zip
Assert goal is fully normalized during assemble
-rw-r--r--compiler/rustc_trait_selection/src/solve/assembly.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/assembly.rs b/compiler/rustc_trait_selection/src/solve/assembly.rs
index 2c92e7eb9ad..45bce34b1ed 100644
--- a/compiler/rustc_trait_selection/src/solve/assembly.rs
+++ b/compiler/rustc_trait_selection/src/solve/assembly.rs
@@ -79,7 +79,7 @@ pub(super) enum CandidateSource {
     AliasBound(usize),
 }
 
-pub(super) trait GoalKind<'tcx>: TypeFoldable<'tcx> + Copy {
+pub(super) trait GoalKind<'tcx>: TypeFoldable<'tcx> + Copy + Eq {
     fn self_ty(self) -> Ty<'tcx>;
 
     fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self;
@@ -124,6 +124,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
         &mut self,
         goal: Goal<'tcx, G>,
     ) -> Vec<Candidate<'tcx>> {
+        debug_assert_eq!(goal, self.infcx.resolve_vars_if_possible(goal));
+
         // HACK: `_: Trait` is ambiguous, because it may be satisfied via a builtin rule,
         // object bound, alias bound, etc. We are unable to determine this until we can at
         // least structually resolve the type one layer.
@@ -179,6 +181,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
                 Ok((_, certainty)) => certainty,
                 Err(NoSolution) => return,
             };
+            let normalized_ty = self.infcx.resolve_vars_if_possible(normalized_ty);
 
             // NOTE: Alternatively we could call `evaluate_goal` here and only have a `Normalized` candidate.
             // This doesn't work as long as we use `CandidateSource` in winnowing.