1
Fork 0

Avoid an ICE and instead let the compiler report a useful error

This commit is contained in:
Oli Scherer 2022-06-21 08:47:02 +00:00
parent 42dcf70f99
commit d2ea7e2059
3 changed files with 32 additions and 1 deletions

View file

@ -662,7 +662,11 @@ where
match b.kind() {
ty::ConstKind::Infer(InferConst::Var(_)) if D::forbid_inference_vars() => {
// Forbid inference variables in the RHS.
bug!("unexpected inference var {:?}", b)
self.infcx.tcx.sess.delay_span_bug(
self.delegate.span(),
format!("unexpected inference var {:?}", b,),
);
Ok(a)
}
// FIXME(invariance): see the related FIXME above.
_ => self.infcx.super_combine_consts(self, a, b),