@@ -68,8 +68,8 @@ pub fn is_const_evaluatable<'tcx>(
6868 // here.
6969 tcx. dcx ( ) . span_bug ( span, "evaluating `ConstKind::Expr` is not currently supported" ) ;
7070 }
71- ty:: ConstKind :: Unevaluated ( _ ) => {
72- match crate :: traits:: try_evaluate_const ( infcx, unexpanded_ct , param_env) {
71+ ty:: ConstKind :: Unevaluated ( uv ) => {
72+ match crate :: traits:: try_evaluate_const ( infcx, uv , param_env) {
7373 Err ( EvaluateConstErr :: HasGenericsOrInfers ) => {
7474 Err ( NotConstEvaluatable :: Error ( infcx. dcx ( ) . span_delayed_bug (
7575 span,
@@ -89,7 +89,14 @@ pub fn is_const_evaluatable<'tcx>(
8989 // This is a sanity check to make sure that non-generics consts are checked to
9090 // be evaluatable in case they aren't cchecked elsewhere. This will NOT error
9191 // if the const uses generics, as desired.
92- crate :: traits:: evaluate_const ( infcx, unexpanded_ct, param_env) ;
92+ let uv = match unexpanded_ct. kind ( ) {
93+ ty:: ConstKind :: Unevaluated ( uv) => uv,
94+ ty:: ConstKind :: Expr ( _) => {
95+ bug ! ( "`ConstKind::Expr` without `feature(generic_const_exprs)` enabled" )
96+ }
97+ _ => bug ! ( "unexpected constkind in `is_const_evalautable: {unexpanded_ct:?}`" ) ,
98+ } ;
99+ crate :: traits:: evaluate_const ( infcx, uv, param_env) ;
93100 Ok ( ( ) )
94101 } else {
95102 let uv = match unexpanded_ct. kind ( ) {
@@ -100,7 +107,7 @@ pub fn is_const_evaluatable<'tcx>(
100107 _ => bug ! ( "unexpected constkind in `is_const_evalautable: {unexpanded_ct:?}`" ) ,
101108 } ;
102109
103- match crate :: traits:: try_evaluate_const ( infcx, unexpanded_ct , param_env) {
110+ match crate :: traits:: try_evaluate_const ( infcx, uv , param_env) {
104111 // If we're evaluating a generic foreign constant, under a nightly compiler while
105112 // the current crate does not enable `feature(generic_const_exprs)`, abort
106113 // compilation with a useful error.
0 commit comments