1
Fork 0

Set !const_evaluatable if ambig. and not inferred

This prevents an ICE due to a value not actually being evaluatable later.
This commit is contained in:
kadmin 2022-12-20 03:36:32 +00:00
parent 77b61379b6
commit b79a9a0900
3 changed files with 48 additions and 12 deletions

View file

@ -215,18 +215,16 @@ fn satisfied_from_param_env<'tcx>(
}
}
if let Some(c) = single_match {
if let Ok(c) = c {
let is_ok = infcx
.commit_if_ok(|_| {
let ocx = ObligationCtxt::new_in_snapshot(infcx);
assert!(ocx.eq(&ObligationCause::dummy(), param_env, c.ty(), ct.ty()).is_ok());
assert!(ocx.eq(&ObligationCause::dummy(), param_env, c, ct).is_ok());
if ocx.select_all_or_error().is_empty() { Ok(()) } else { Err(()) }
})
.is_ok();
assert!(is_ok);
}
if let Some(Ok(c)) = single_match {
let is_ok = infcx
.commit_if_ok(|_| {
let ocx = ObligationCtxt::new_in_snapshot(infcx);
assert!(ocx.eq(&ObligationCause::dummy(), param_env, c.ty(), ct.ty()).is_ok());
assert!(ocx.eq(&ObligationCause::dummy(), param_env, c, ct).is_ok());
if ocx.select_all_or_error().is_empty() { Ok(()) } else { Err(()) }
})
.is_ok();
assert!(is_ok);
return true;
}