@@ -810,6 +810,29 @@ macro_rules! gate_feature_post {
810810 } }
811811}
812812
813+ impl < ' a > PostExpansionVisitor < ' a > {
814+ fn check_abi ( & self , abi : Abi , span : Span ) {
815+ match abi {
816+ Abi :: RustIntrinsic =>
817+ gate_feature_post ! ( & self , intrinsics, span,
818+ "intrinsics are subject to change" ) ,
819+ Abi :: PlatformIntrinsic => {
820+ gate_feature_post ! ( & self , platform_intrinsics, span,
821+ "platform intrinsics are experimental and possibly buggy" )
822+ } ,
823+ Abi :: Vectorcall => {
824+ gate_feature_post ! ( & self , abi_vectorcall, span,
825+ "vectorcall is experimental and subject to change" )
826+ }
827+ Abi :: RustCall => {
828+ gate_feature_post ! ( & self , unboxed_closures, span,
829+ "rust-call ABI is subject to change" ) ;
830+ }
831+ _ => { }
832+ }
833+ }
834+ }
835+
813836impl < ' a > Visitor for PostExpansionVisitor < ' a > {
814837 fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
815838 if !self . context . cm . span_allows_unstable ( attr. span ) {
@@ -841,21 +864,7 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
841864 across platforms, it is recommended to \
842865 use `#[link(name = \" foo\" )]` instead")
843866 }
844- match foreign_module. abi {
845- Abi :: RustIntrinsic =>
846- gate_feature_post ! ( & self , intrinsics, i. span,
847- "intrinsics are subject to change" ) ,
848- Abi :: PlatformIntrinsic => {
849- gate_feature_post ! ( & self , platform_intrinsics, i. span,
850- "platform intrinsics are experimental \
851- and possibly buggy")
852- } ,
853- Abi :: Vectorcall => {
854- gate_feature_post ! ( & self , abi_vectorcall, i. span,
855- "vectorcall is experimental and subject to change" )
856- }
857- _ => ( )
858- }
867+ self . check_abi ( foreign_module. abi , i. span ) ;
859868 }
860869
861870 ast:: ItemKind :: Fn ( ..) => {
@@ -938,6 +947,16 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
938947 visit:: walk_foreign_item ( self , i)
939948 }
940949
950+ fn visit_ty ( & mut self , ty : & ast:: Ty ) {
951+ match ty. node {
952+ ast:: TyKind :: BareFn ( ref bare_fn_ty) => {
953+ self . check_abi ( bare_fn_ty. abi , ty. span ) ;
954+ }
955+ _ => { }
956+ }
957+ visit:: walk_ty ( self , ty)
958+ }
959+
941960 fn visit_expr ( & mut self , e : & ast:: Expr ) {
942961 match e. node {
943962 ast:: ExprKind :: Box ( _) => {
@@ -1025,23 +1044,10 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
10251044 }
10261045
10271046 match fn_kind {
1028- FnKind :: ItemFn ( _, _, _, _, abi, _) if abi == Abi :: RustIntrinsic => {
1029- gate_feature_post ! ( & self , intrinsics,
1030- span,
1031- "intrinsics are subject to change" )
1032- }
10331047 FnKind :: ItemFn ( _, _, _, _, abi, _) |
1034- FnKind :: Method ( _, & ast:: MethodSig { abi, .. } , _) => match abi {
1035- Abi :: RustCall => {
1036- gate_feature_post ! ( & self , unboxed_closures, span,
1037- "rust-call ABI is subject to change" ) ;
1038- } ,
1039- Abi :: Vectorcall => {
1040- gate_feature_post ! ( & self , abi_vectorcall, span,
1041- "vectorcall is experimental and subject to change" ) ;
1042- } ,
1043- _ => { }
1044- } ,
1048+ FnKind :: Method ( _, & ast:: MethodSig { abi, .. } , _) => {
1049+ self . check_abi ( abi, span) ;
1050+ }
10451051 _ => { }
10461052 }
10471053 visit:: walk_fn ( self , fn_kind, fn_decl, block, span) ;
@@ -1054,7 +1060,10 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
10541060 ti. span,
10551061 "associated constants are experimental" )
10561062 }
1057- ast:: TraitItemKind :: Method ( ref sig, _) => {
1063+ ast:: TraitItemKind :: Method ( ref sig, ref block) => {
1064+ if block. is_none ( ) {
1065+ self . check_abi ( sig. abi , ti. span ) ;
1066+ }
10581067 if sig. constness == ast:: Constness :: Const {
10591068 gate_feature_post ! ( & self , const_fn, ti. span, "const fn is unstable" ) ;
10601069 }
0 commit comments