From 342ec83629b71ab3d63b55e193fa43b72857a434 Mon Sep 17 00:00:00 2001 From: Ellen Date: Tue, 2 Mar 2021 19:33:28 +0000 Subject: [PATCH] nits --- .../src/traits/const_evaluatable.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index e9bf537d6bf..7e0c74c8d2b 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -108,7 +108,10 @@ enum FailureKind { FailureKind::MentionsParam => { return Err(NotConstEvaluatable::MentionsParam); } - _ => (), + FailureKind::Concrete => { + // Dealt with below by the same code which handles this + // without the feature gate. + } } } None => { @@ -158,10 +161,12 @@ enum FailureKind { debug!(?concrete, "is_const_evaluatable"); match concrete { - Err(ErrorHandled::TooGeneric) if !substs.has_infer_types_or_consts() => { - Err(NotConstEvaluatable::MentionsParam) + Err(ErrorHandled::TooGeneric) => { + return Err(match substs.has_infer_types_or_consts() { + true => NotConstEvaluatable::MentionsInfer, + false => NotConstEvaluatable::MentionsParam, + }); } - Err(ErrorHandled::TooGeneric) => Err(NotConstEvaluatable::MentionsInfer), Err(ErrorHandled::Linted) => { infcx.tcx.sess.delay_span_bug(span, "constant in type had error reported as lint"); Err(NotConstEvaluatable::Error(ErrorReported))