@@ -1032,8 +1032,6 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1032
1032
} ;
1033
1033
let (
1034
1034
decl,
1035
- unsafety,
1036
- abi,
1037
1035
block,
1038
1036
constness,
1039
1037
) = match try!( eval_const_expr_partial ( tcx, callee, sub_ty_hint, fn_args) ) {
@@ -1042,12 +1040,12 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1042
1040
Some ( ast_map:: NodeItem ( it) ) => match it. node {
1043
1041
hir:: ItemFn (
1044
1042
ref decl,
1045
- unsafety ,
1043
+ hir :: Unsafety :: Normal ,
1046
1044
constness,
1047
- abi,
1045
+ abi:: Abi :: Rust ,
1048
1046
_, // ducktype generics? types are funky in const_eval
1049
1047
ref block,
1050
- ) => ( decl, unsafety , abi , block, constness) ,
1048
+ ) => ( decl, block, constness) ,
1051
1049
_ => signal ! ( e, NonConstPath ) ,
1052
1050
} ,
1053
1051
_ => signal ! ( e, NonConstPath ) ,
@@ -1057,18 +1055,19 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1057
1055
} ,
1058
1056
_ => signal ! ( e, NonConstPath ) ,
1059
1057
} ;
1060
- if let ExprTypeChecked = ty_hint {
1061
- // no need to check for constness... either check_const
1062
- // already forbids this or we const eval over whatever
1063
- // we want
1064
- } else {
1065
- // we don't know much about the function, so we force it to be a const fn
1066
- // so compilation will fail later in case the const fn's body is not const
1067
- assert_eq ! ( constness, hir:: Constness :: Const )
1058
+ match ( ty_hint, constness) {
1059
+ ( ExprTypeChecked , _) => {
1060
+ // no need to check for constness... either check_const
1061
+ // already forbids this or we const eval over whatever
1062
+ // we want
1063
+ } ,
1064
+ ( _, hir:: Constness :: Const ) => {
1065
+ // we don't know much about the function, so we force it to be a const fn
1066
+ // so compilation will fail later in case the const fn's body is not const
1067
+ } ,
1068
+ _ => signal ! ( e, NonConstPath ) ,
1068
1069
}
1069
1070
assert_eq ! ( decl. inputs. len( ) , args. len( ) ) ;
1070
- assert_eq ! ( unsafety, hir:: Unsafety :: Normal ) ;
1071
- assert_eq ! ( abi, abi:: Abi :: Rust ) ;
1072
1071
1073
1072
let mut call_args = NodeMap ( ) ;
1074
1073
for ( arg, arg_expr) in decl. inputs . iter ( ) . zip ( args. iter ( ) ) {
0 commit comments