@@ -800,6 +800,29 @@ macro_rules! gate_feature_post {
800800 } }
801801}
802802
803+ impl < ' a > PostExpansionVisitor < ' a > {
804+ fn check_abi ( & self , abi : Abi , span : Span ) {
805+ match abi {
806+ Abi :: RustIntrinsic =>
807+ gate_feature_post ! ( & self , intrinsics, span,
808+ "intrinsics are subject to change" ) ,
809+ Abi :: PlatformIntrinsic => {
810+ gate_feature_post ! ( & self , platform_intrinsics, span,
811+ "platform intrinsics are experimental and possibly buggy" )
812+ } ,
813+ Abi :: Vectorcall => {
814+ gate_feature_post ! ( & self , abi_vectorcall, span,
815+ "vectorcall is experimental and subject to change" )
816+ }
817+ Abi :: RustCall => {
818+ gate_feature_post ! ( & self , unboxed_closures, span,
819+ "rust-call ABI is subject to change" ) ;
820+ }
821+ _ => { }
822+ }
823+ }
824+ }
825+
803826impl < ' a > Visitor for PostExpansionVisitor < ' a > {
804827 fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
805828 if !self . context . cm . span_allows_unstable ( attr. span ) {
@@ -831,21 +854,7 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
831854 across platforms, it is recommended to \
832855 use `#[link(name = \" foo\" )]` instead")
833856 }
834- match foreign_module. abi {
835- Abi :: RustIntrinsic =>
836- gate_feature_post ! ( & self , intrinsics, i. span,
837- "intrinsics are subject to change" ) ,
838- Abi :: PlatformIntrinsic => {
839- gate_feature_post ! ( & self , platform_intrinsics, i. span,
840- "platform intrinsics are experimental \
841- and possibly buggy")
842- } ,
843- Abi :: Vectorcall => {
844- gate_feature_post ! ( & self , abi_vectorcall, i. span,
845- "vectorcall is experimental and subject to change" )
846- }
847- _ => ( )
848- }
857+ self . check_abi ( foreign_module. abi , i. span ) ;
849858 }
850859
851860 ast:: ItemKind :: Fn ( ..) => {
@@ -928,6 +937,16 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
928937 visit:: walk_foreign_item ( self , i)
929938 }
930939
940+ fn visit_ty ( & mut self , ty : & ast:: Ty ) {
941+ match ty. node {
942+ ast:: TyKind :: BareFn ( ref bare_fn_ty) => {
943+ self . check_abi ( bare_fn_ty. abi , ty. span ) ;
944+ }
945+ _ => { }
946+ }
947+ visit:: walk_ty ( self , ty)
948+ }
949+
931950 fn visit_expr ( & mut self , e : & ast:: Expr ) {
932951 match e. node {
933952 ast:: ExprKind :: Box ( _) => {
@@ -1015,23 +1034,10 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
10151034 }
10161035
10171036 match fn_kind {
1018- FnKind :: ItemFn ( _, _, _, _, abi, _) if abi == Abi :: RustIntrinsic => {
1019- gate_feature_post ! ( & self , intrinsics,
1020- span,
1021- "intrinsics are subject to change" )
1022- }
10231037 FnKind :: ItemFn ( _, _, _, _, abi, _) |
1024- FnKind :: Method ( _, & ast:: MethodSig { abi, .. } , _) => match abi {
1025- Abi :: RustCall => {
1026- gate_feature_post ! ( & self , unboxed_closures, span,
1027- "rust-call ABI is subject to change" ) ;
1028- } ,
1029- Abi :: Vectorcall => {
1030- gate_feature_post ! ( & self , abi_vectorcall, span,
1031- "vectorcall is experimental and subject to change" ) ;
1032- } ,
1033- _ => { }
1034- } ,
1038+ FnKind :: Method ( _, & ast:: MethodSig { abi, .. } , _) => {
1039+ self . check_abi ( abi, span) ;
1040+ }
10351041 _ => { }
10361042 }
10371043 visit:: walk_fn ( self , fn_kind, fn_decl, block, span) ;
@@ -1044,7 +1050,10 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
10441050 ti. span,
10451051 "associated constants are experimental" )
10461052 }
1047- ast:: TraitItemKind :: Method ( ref sig, _) => {
1053+ ast:: TraitItemKind :: Method ( ref sig, ref block) => {
1054+ if block. is_none ( ) {
1055+ self . check_abi ( sig. abi , ti. span ) ;
1056+ }
10481057 if sig. constness == ast:: Constness :: Const {
10491058 gate_feature_post ! ( & self , const_fn, ti. span, "const fn is unstable" ) ;
10501059 }
0 commit comments