@@ -30,24 +30,24 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
30
30
span : Span ,
31
31
) -> Result < ( ) , ErrorHandled > {
32
32
debug ! ( "is_const_evaluatable({:?}, {:?})" , def, substs) ;
33
- // `AbstractConst::new` already returns `None` if ` const_evaluatable_checked`
34
- // is not active, so we don't have to explicitly check for this here.
35
- if let Some ( ct ) = AbstractConst :: new ( infcx . tcx , def , substs ) {
36
- for pred in param_env . caller_bounds ( ) {
37
- match pred . skip_binders ( ) {
38
- ty :: PredicateAtom :: ConstEvaluatable ( b_def, b_substs) => {
39
- debug ! ( "is_const_evaluatable: caller_bound={:?}, {:?}" , b_def, b_substs) ;
40
- if b_def == def && b_substs == substs {
41
- debug ! ( "is_const_evaluatable: caller_bound ~~> ok" ) ;
42
- return Ok ( ( ) ) ;
43
- } else if AbstractConst :: new ( infcx. tcx , b_def , b_substs )
44
- . map_or ( false , |b_ct| try_unify ( infcx . tcx , ct , b_ct ) )
45
- {
46
- debug ! ( "is_const_evaluatable: abstract_const ~~> ok" ) ;
47
- return Ok ( ( ) ) ;
33
+ if infcx . tcx . features ( ) . const_evaluatable_checked {
34
+ if let Some ( ct ) = AbstractConst :: new ( infcx . tcx , def , substs ) {
35
+ for pred in param_env . caller_bounds ( ) {
36
+ match pred . skip_binders ( ) {
37
+ ty :: PredicateAtom :: ConstEvaluatable ( b_def , b_substs ) => {
38
+ debug ! ( "is_const_evaluatable: caller_bound={:?}, {:?}" , b_def, b_substs) ;
39
+ if b_def == def && b_substs == substs {
40
+ debug ! ( "is_const_evaluatable: caller_bound ~~> ok" ) ;
41
+ return Ok ( ( ) ) ;
42
+ } else if AbstractConst :: new ( infcx . tcx , b_def , b_substs )
43
+ . map_or ( false , |b_ct| try_unify ( infcx. tcx , ct , b_ct ) )
44
+ {
45
+ debug ! ( "is_const_evaluatable: abstract_const ~~> ok" ) ;
46
+ return Ok ( ( ) ) ;
47
+ }
48
48
}
49
+ _ => { } // don't care
49
50
}
50
- _ => { } // don't care
51
51
}
52
52
}
53
53
}
0 commit comments