@@ -810,6 +810,29 @@ macro_rules! gate_feature_post {
810
810
} }
811
811
}
812
812
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
+
813
836
impl < ' a > Visitor for PostExpansionVisitor < ' a > {
814
837
fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
815
838
if !self . context . cm . span_allows_unstable ( attr. span ) {
@@ -841,21 +864,7 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
841
864
across platforms, it is recommended to \
842
865
use `#[link(name = \" foo\" )]` instead")
843
866
}
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 ) ;
859
868
}
860
869
861
870
ast:: ItemKind :: Fn ( ..) => {
@@ -938,6 +947,16 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
938
947
visit:: walk_foreign_item ( self , i)
939
948
}
940
949
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
+
941
960
fn visit_expr ( & mut self , e : & ast:: Expr ) {
942
961
match e. node {
943
962
ast:: ExprKind :: Box ( _) => {
@@ -1025,23 +1044,10 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
1025
1044
}
1026
1045
1027
1046
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
- }
1033
1047
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
+ }
1045
1051
_ => { }
1046
1052
}
1047
1053
visit:: walk_fn ( self , fn_kind, fn_decl, block, span) ;
@@ -1054,7 +1060,10 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
1054
1060
ti. span,
1055
1061
"associated constants are experimental" )
1056
1062
}
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
+ }
1058
1067
if sig. constness == ast:: Constness :: Const {
1059
1068
gate_feature_post ! ( & self , const_fn, ti. span, "const fn is unstable" ) ;
1060
1069
}
0 commit comments