Skip to content

Commit aee75f2

Browse files
Assert goal is fully normalized during assemble
1 parent c9c8e29 commit aee75f2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_trait_selection/src/solve/assembly.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub(super) enum CandidateSource {
7979
AliasBound(usize),
8080
}
8181

82-
pub(super) trait GoalKind<'tcx>: TypeFoldable<'tcx> + Copy {
82+
pub(super) trait GoalKind<'tcx>: TypeFoldable<'tcx> + Copy + Eq {
8383
fn self_ty(self) -> Ty<'tcx>;
8484

8585
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self;
@@ -124,6 +124,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
124124
&mut self,
125125
goal: Goal<'tcx, G>,
126126
) -> Vec<Candidate<'tcx>> {
127+
debug_assert_eq!(goal, self.infcx.resolve_vars_if_possible(goal));
128+
127129
// HACK: `_: Trait` is ambiguous, because it may be satisfied via a builtin rule,
128130
// object bound, alias bound, etc. We are unable to determine this until we can at
129131
// least structually resolve the type one layer.
@@ -179,6 +181,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
179181
Ok((_, certainty)) => certainty,
180182
Err(NoSolution) => return,
181183
};
184+
let normalized_ty = self.infcx.resolve_vars_if_possible(normalized_ty);
182185

183186
// NOTE: Alternatively we could call `evaluate_goal` here and only have a `Normalized` candidate.
184187
// This doesn't work as long as we use `CandidateSource` in winnowing.

0 commit comments

Comments
 (0)