This commit is contained in:
Ellen 2021-03-02 19:33:28 +00:00
parent f97e075e92
commit 342ec83629

View File

@ -108,7 +108,10 @@ enum FailureKind {
FailureKind::MentionsParam => { FailureKind::MentionsParam => {
return Err(NotConstEvaluatable::MentionsParam); return Err(NotConstEvaluatable::MentionsParam);
} }
_ => (), FailureKind::Concrete => {
// Dealt with below by the same code which handles this
// without the feature gate.
}
} }
} }
None => { None => {
@ -158,10 +161,12 @@ enum FailureKind {
debug!(?concrete, "is_const_evaluatable"); debug!(?concrete, "is_const_evaluatable");
match concrete { match concrete {
Err(ErrorHandled::TooGeneric) if !substs.has_infer_types_or_consts() => { Err(ErrorHandled::TooGeneric) => {
Err(NotConstEvaluatable::MentionsParam) return Err(match substs.has_infer_types_or_consts() {
true => NotConstEvaluatable::MentionsInfer,
false => NotConstEvaluatable::MentionsParam,
});
} }
Err(ErrorHandled::TooGeneric) => Err(NotConstEvaluatable::MentionsInfer),
Err(ErrorHandled::Linted) => { Err(ErrorHandled::Linted) => {
infcx.tcx.sess.delay_span_bug(span, "constant in type had error reported as lint"); infcx.tcx.sess.delay_span_bug(span, "constant in type had error reported as lint");
Err(NotConstEvaluatable::Error(ErrorReported)) Err(NotConstEvaluatable::Error(ErrorReported))