@@ -58,6 +58,7 @@ use middle::subst::{FnSpace, TypeSpace, SelfSpace, Subst, Substs};
58
58
use middle:: traits;
59
59
use middle:: ty:: { self , RegionEscape , Ty , ToPredicate , HasTypeFlags } ;
60
60
use middle:: ty_fold;
61
+ use require_c_abi_if_variadic;
61
62
use rscope:: { self , UnelidableRscope , RegionScope , ElidableRscope , ExplicitRscope ,
62
63
ObjectLifetimeDefaultRscope , ShiftedRscope , BindingRscope ,
63
64
ElisionFailureInfo , ElidedLifetime } ;
@@ -1574,10 +1575,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
1574
1575
}
1575
1576
ast:: TyParen ( ref typ) => ast_ty_to_ty ( this, rscope, & * * typ) ,
1576
1577
ast:: TyBareFn ( ref bf) => {
1577
- if bf. decl . variadic && bf. abi != abi:: C {
1578
- span_err ! ( tcx. sess, ast_ty. span, E0045 ,
1579
- "variadic function must have C calling convention" ) ;
1580
- }
1578
+ require_c_abi_if_variadic ( tcx, & bf. decl , bf. abi , ast_ty. span ) ;
1581
1579
let bare_fn = ty_of_bare_fn ( this, bf. unsafety , bf. abi , & * bf. decl ) ;
1582
1580
tcx. mk_fn ( None , tcx. mk_bare_fn ( bare_fn) )
1583
1581
}
0 commit comments