Skip to content

Commit e44e65e

Browse files
committed
Assert is_associated_const when resolving
1 parent bc243a7 commit e44e65e

File tree

1 file changed

+4
-3
lines changed
  • compiler/rustc_mir_build/src/thir/pattern

1 file changed

+4
-3
lines changed

compiler/rustc_mir_build/src/thir/pattern/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
469469
let instance = match ty::Instance::resolve(self.tcx, param_env_reveal_all, def_id, substs) {
470470
Ok(Some(i)) => i,
471471
Ok(None) => {
472-
if is_associated_const {
473-
self.errors.push(PatternError::AssocConstInPattern(span));
474-
}
472+
// It should be assoc consts if there's no error but we cannot resolve it.
473+
debug_assert!(is_associated_const);
474+
475+
self.errors.push(PatternError::AssocConstInPattern(span));
475476

476477
return pat_from_kind(PatKind::Wild);
477478
}

0 commit comments

Comments
 (0)