1
Fork 0

handle consts with param/infer in const_eval_resolve better

This commit is contained in:
Michael Goulet 2022-07-22 01:46:43 +00:00
parent 6dbae3ad19
commit f1618e8924
4 changed files with 47 additions and 62 deletions

View file

@ -185,21 +185,12 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
}
let concrete = infcx.const_eval_resolve(param_env, uv.expand(), Some(span));
match concrete {
Err(ErrorHandled::TooGeneric) => Err(if uv.has_infer_types_or_consts() {
NotConstEvaluatable::MentionsInfer
} else if uv.has_param_types_or_consts() {
infcx
.tcx
.sess
.delay_span_bug(span, &format!("unexpected `TooGeneric` for {:?}", uv));
NotConstEvaluatable::MentionsParam
} else {
let guar = infcx.tcx.sess.delay_span_bug(
Err(ErrorHandled::TooGeneric) => {
Err(NotConstEvaluatable::Error(infcx.tcx.sess.delay_span_bug(
span,
format!("Missing value for constant, but no error reported?"),
);
NotConstEvaluatable::Error(guar)
}),
)))
}
Err(ErrorHandled::Linted) => {
let reported = infcx
.tcx