@@ -1055,8 +1055,6 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10551055 } ;
10561056 let (
10571057 decl,
1058- unsafety,
1059- abi,
10601058 block,
10611059 constness,
10621060 ) = 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>,
10651063 Some ( ast_map:: NodeItem ( it) ) => match it. node {
10661064 hir:: ItemFn (
10671065 ref decl,
1068- unsafety ,
1066+ hir :: Unsafety :: Normal ,
10691067 constness,
1070- abi,
1068+ abi:: Abi :: Rust ,
10711069 _, // ducktype generics? types are funky in const_eval
10721070 ref block,
1073- ) => ( decl, unsafety , abi , block, constness) ,
1071+ ) => ( decl, block, constness) ,
10741072 _ => signal ! ( e, NonConstPath ) ,
10751073 } ,
10761074 _ => signal ! ( e, NonConstPath ) ,
@@ -1080,18 +1078,19 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10801078 } ,
10811079 _ => signal ! ( e, NonConstPath ) ,
10821080 } ;
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 ) ,
10911092 }
10921093 assert_eq ! ( decl. inputs. len( ) , args. len( ) ) ;
1093- assert_eq ! ( unsafety, hir:: Unsafety :: Normal ) ;
1094- assert_eq ! ( abi, abi:: Abi :: Rust ) ;
10951094
10961095 let mut call_args = NodeMap ( ) ;
10971096 for ( arg, arg_expr) in decl. inputs . iter ( ) . zip ( args. iter ( ) ) {
0 commit comments