@@ -1055,8 +1055,6 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1055
1055
} ;
1056
1056
let (
1057
1057
decl,
1058
- unsafety,
1059
- abi,
1060
1058
block,
1061
1059
constness,
1062
1060
) = match try!( eval_const_expr_partial ( tcx, callee, sub_ty_hint, fn_args) ) {
@@ -1065,12 +1063,12 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1065
1063
Some ( ast_map:: NodeItem ( it) ) => match it. node {
1066
1064
hir:: ItemFn (
1067
1065
ref decl,
1068
- unsafety ,
1066
+ hir :: Unsafety :: Normal ,
1069
1067
constness,
1070
- abi,
1068
+ abi:: Abi :: Rust ,
1071
1069
_, // ducktype generics? types are funky in const_eval
1072
1070
ref block,
1073
- ) => ( decl, unsafety , abi , block, constness) ,
1071
+ ) => ( decl, block, constness) ,
1074
1072
_ => signal ! ( e, NonConstPath ) ,
1075
1073
} ,
1076
1074
_ => signal ! ( e, NonConstPath ) ,
@@ -1080,18 +1078,19 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1080
1078
} ,
1081
1079
_ => signal ! ( e, NonConstPath ) ,
1082
1080
} ;
1083
- if let ExprTypeChecked = ty_hint {
1084
- // no need to check for constness... either check_const
1085
- // already forbids this or we const eval over whatever
1086
- // we want
1087
- } else {
1088
- // we don't know much about the function, so we force it to be a const fn
1089
- // so compilation will fail later in case the const fn's body is not const
1090
- assert_eq ! ( constness, hir:: Constness :: Const )
1081
+ match ( ty_hint, constness) {
1082
+ ( ExprTypeChecked , _) => {
1083
+ // no need to check for constness... either check_const
1084
+ // already forbids this or we const eval over whatever
1085
+ // we want
1086
+ } ,
1087
+ ( _, hir:: Constness :: Const ) => {
1088
+ // we don't know much about the function, so we force it to be a const fn
1089
+ // so compilation will fail later in case the const fn's body is not const
1090
+ } ,
1091
+ _ => signal ! ( e, NonConstPath ) ,
1091
1092
}
1092
1093
assert_eq ! ( decl. inputs. len( ) , args. len( ) ) ;
1093
- assert_eq ! ( unsafety, hir:: Unsafety :: Normal ) ;
1094
- assert_eq ! ( abi, abi:: Abi :: Rust ) ;
1095
1094
1096
1095
let mut call_args = NodeMap ( ) ;
1097
1096
for ( arg, arg_expr) in decl. inputs . iter ( ) . zip ( args. iter ( ) ) {
0 commit comments