1
1
use crate :: ast;
2
2
use crate :: encode;
3
- use crate :: util:: { self , ShortHash } ;
3
+ use crate :: util:: ShortHash ;
4
4
use crate :: Diagnostic ;
5
5
use proc_macro2:: { Ident , Literal , Span , TokenStream } ;
6
6
use quote:: { quote, ToTokens } ;
@@ -41,7 +41,6 @@ impl TryToTokens for ast::Program {
41
41
for i in self . imports . iter ( ) {
42
42
DescribeImport {
43
43
kind : & i. kind ,
44
- unstable_api : i. unstable_api ,
45
44
} . to_tokens ( tokens) ;
46
45
47
46
// If there is a js namespace, check that name isn't a type. If it is,
@@ -298,7 +297,6 @@ impl ToTokens for ast::StructField {
298
297
inner : quote ! {
299
298
<#ty as WasmDescribe >:: describe( ) ;
300
299
} ,
301
- unstable_api : self . unstable_api ,
302
300
attrs : vec ! [ ] ,
303
301
}
304
302
. to_tokens ( tokens) ;
@@ -536,7 +534,6 @@ impl TryToTokens for ast::Export {
536
534
#( <#argtys as WasmDescribe >:: describe( ) ; ) *
537
535
#describe_ret
538
536
} ,
539
- unstable_api : self . unstable_api ,
540
537
attrs : attrs. clone ( ) ,
541
538
}
542
539
. to_tokens ( into) ;
@@ -563,7 +560,6 @@ impl ToTokens for ast::ImportType {
563
560
let vis = & self . vis ;
564
561
let rust_name = & self . rust_name ;
565
562
let attrs = & self . attrs ;
566
- let unstable_api_attr = util:: maybe_unstable_api_attr ( self . unstable_api ) ;
567
563
let doc_comment = match & self . doc_comment {
568
564
None => "" ,
569
565
Some ( comment) => comment,
@@ -612,14 +608,12 @@ impl ToTokens for ast::ImportType {
612
608
#[ doc = #doc_comment]
613
609
#[ repr( transparent) ]
614
610
#[ allow( clippy:: all) ]
615
- #unstable_api_attr
616
611
#vis struct #rust_name {
617
612
obj: #internal_obj
618
613
}
619
614
620
615
#[ allow( bad_style) ]
621
616
#[ allow( clippy:: all) ]
622
- #unstable_api_attr
623
617
const #const_name: ( ) = {
624
618
use wasm_bindgen:: convert:: { IntoWasmAbi , FromWasmAbi } ;
625
619
use wasm_bindgen:: convert:: { OptionIntoWasmAbi , OptionFromWasmAbi } ;
@@ -770,7 +764,6 @@ impl ToTokens for ast::ImportType {
770
764
for superclass in self . extends . iter ( ) {
771
765
( quote ! {
772
766
#[ allow( clippy:: all) ]
773
- #unstable_api_attr
774
767
impl From <#rust_name> for #superclass {
775
768
#[ inline]
776
769
fn from( obj: #rust_name) -> #superclass {
@@ -780,7 +773,6 @@ impl ToTokens for ast::ImportType {
780
773
}
781
774
782
775
#[ allow( clippy:: all) ]
783
- #unstable_api_attr
784
776
impl AsRef <#superclass> for #rust_name {
785
777
#[ inline]
786
778
fn as_ref( & self ) -> & #superclass {
@@ -802,7 +794,6 @@ impl ToTokens for ast::ImportEnum {
802
794
let variants = & self . variants ;
803
795
let variant_strings = & self . variant_values ;
804
796
let attrs = & self . rust_attrs ;
805
- let unstable_api_attr = util:: maybe_unstable_api_attr ( self . unstable_api ) ;
806
797
807
798
let mut current_idx: usize = 0 ;
808
799
let variant_indexes: Vec < Literal > = variants
@@ -831,15 +822,13 @@ impl ToTokens for ast::ImportEnum {
831
822
#[ allow( bad_style) ]
832
823
#( #attrs) *
833
824
#[ allow( clippy:: all) ]
834
- #unstable_api_attr
835
825
#vis enum #name {
836
826
#( #variants = #variant_indexes_ref, ) *
837
827
#[ doc( hidden) ]
838
828
__Nonexhaustive,
839
829
}
840
830
841
831
#[ allow( clippy:: all) ]
842
- #unstable_api_attr
843
832
impl #name {
844
833
#vis fn from_js_value( obj: & wasm_bindgen:: JsValue ) -> Option <#name> {
845
834
obj. as_string( ) . and_then( |obj_str| match obj_str. as_str( ) {
@@ -850,15 +839,13 @@ impl ToTokens for ast::ImportEnum {
850
839
}
851
840
852
841
#[ allow( clippy:: all) ]
853
- #unstable_api_attr
854
842
impl wasm_bindgen:: describe:: WasmDescribe for #name {
855
843
fn describe( ) {
856
844
wasm_bindgen:: JsValue :: describe( )
857
845
}
858
846
}
859
847
860
848
#[ allow( clippy:: all) ]
861
- #unstable_api_attr
862
849
impl wasm_bindgen:: convert:: IntoWasmAbi for #name {
863
850
type Abi = <wasm_bindgen:: JsValue as
864
851
wasm_bindgen:: convert:: IntoWasmAbi >:: Abi ;
@@ -870,7 +857,6 @@ impl ToTokens for ast::ImportEnum {
870
857
}
871
858
872
859
#[ allow( clippy:: all) ]
873
- #unstable_api_attr
874
860
impl wasm_bindgen:: convert:: FromWasmAbi for #name {
875
861
type Abi = <wasm_bindgen:: JsValue as
876
862
wasm_bindgen:: convert:: FromWasmAbi >:: Abi ;
@@ -881,21 +867,18 @@ impl ToTokens for ast::ImportEnum {
881
867
}
882
868
883
869
#[ allow( clippy:: all) ]
884
- #unstable_api_attr
885
870
impl wasm_bindgen:: convert:: OptionIntoWasmAbi for #name {
886
871
#[ inline]
887
872
fn none( ) -> Self :: Abi { Object :: none( ) }
888
873
}
889
874
890
875
#[ allow( clippy:: all) ]
891
- #unstable_api_attr
892
876
impl wasm_bindgen:: convert:: OptionFromWasmAbi for #name {
893
877
#[ inline]
894
878
fn is_none( abi: & Self :: Abi ) -> bool { Object :: is_none( abi) }
895
879
}
896
880
897
881
#[ allow( clippy:: all) ]
898
- #unstable_api_attr
899
882
impl From <#name> for wasm_bindgen:: JsValue {
900
883
fn from( obj: #name) -> wasm_bindgen:: JsValue {
901
884
match obj {
@@ -1007,7 +990,6 @@ impl TryToTokens for ast::ImportFunction {
1007
990
let arguments = & arguments;
1008
991
let abi_arguments = & abi_arguments;
1009
992
let abi_argument_names = & abi_argument_names;
1010
- let unstable_api_attr = util:: maybe_unstable_api_attr ( self . unstable_api ) ;
1011
993
1012
994
let doc_comment = match & self . doc_comment {
1013
995
None => "" ,
@@ -1075,7 +1057,6 @@ impl TryToTokens for ast::ImportFunction {
1075
1057
1076
1058
if let Some ( class) = class_ty {
1077
1059
( quote ! {
1078
- #unstable_api_attr
1079
1060
impl #class {
1080
1061
#invocation
1081
1062
}
@@ -1092,7 +1073,6 @@ impl TryToTokens for ast::ImportFunction {
1092
1073
// See comment above in ast::Export for what's going on here.
1093
1074
struct DescribeImport < ' a > {
1094
1075
kind : & ' a ast:: ImportKind ,
1095
- unstable_api : bool ,
1096
1076
}
1097
1077
1098
1078
impl < ' a > ToTokens for DescribeImport < ' a > {
@@ -1119,7 +1099,6 @@ impl<'a> ToTokens for DescribeImport<'a> {
1119
1099
#( <#argtys as WasmDescribe >:: describe( ) ; ) *
1120
1100
#inform_ret
1121
1101
} ,
1122
- unstable_api : self . unstable_api ,
1123
1102
attrs : f. function . rust_attrs . clone ( ) ,
1124
1103
}
1125
1104
. to_tokens ( tokens) ;
@@ -1130,7 +1109,6 @@ impl ToTokens for ast::Enum {
1130
1109
fn to_tokens ( & self , into : & mut TokenStream ) {
1131
1110
let enum_name = & self . name ;
1132
1111
let hole = & self . hole ;
1133
- let unstable_api_attr = util:: maybe_unstable_api_attr ( self . unstable_api ) ;
1134
1112
let cast_clauses = self . variants . iter ( ) . map ( |variant| {
1135
1113
let variant_name = & variant. name ;
1136
1114
quote ! {
@@ -1141,7 +1119,6 @@ impl ToTokens for ast::Enum {
1141
1119
} ) ;
1142
1120
( quote ! {
1143
1121
#[ allow( clippy:: all) ]
1144
- #unstable_api_attr
1145
1122
impl wasm_bindgen:: convert:: IntoWasmAbi for #enum_name {
1146
1123
type Abi = u32 ;
1147
1124
@@ -1152,7 +1129,6 @@ impl ToTokens for ast::Enum {
1152
1129
}
1153
1130
1154
1131
#[ allow( clippy:: all) ]
1155
- #unstable_api_attr
1156
1132
impl wasm_bindgen:: convert:: FromWasmAbi for #enum_name {
1157
1133
type Abi = u32 ;
1158
1134
@@ -1165,21 +1141,18 @@ impl ToTokens for ast::Enum {
1165
1141
}
1166
1142
1167
1143
#[ allow( clippy:: all) ]
1168
- #unstable_api_attr
1169
1144
impl wasm_bindgen:: convert:: OptionFromWasmAbi for #enum_name {
1170
1145
#[ inline]
1171
1146
fn is_none( val: & u32 ) -> bool { * val == #hole }
1172
1147
}
1173
1148
1174
1149
#[ allow( clippy:: all) ]
1175
- #unstable_api_attr
1176
1150
impl wasm_bindgen:: convert:: OptionIntoWasmAbi for #enum_name {
1177
1151
#[ inline]
1178
1152
fn none( ) -> Self :: Abi { #hole }
1179
1153
}
1180
1154
1181
1155
#[ allow( clippy:: all) ]
1182
- #unstable_api_attr
1183
1156
impl wasm_bindgen:: describe:: WasmDescribe for #enum_name {
1184
1157
fn describe( ) {
1185
1158
use wasm_bindgen:: describe:: * ;
@@ -1230,7 +1203,6 @@ impl ToTokens for ast::ImportStatic {
1230
1203
inner : quote ! {
1231
1204
<#ty as WasmDescribe >:: describe( ) ;
1232
1205
} ,
1233
- unstable_api : false ,
1234
1206
attrs : vec ! [ ] ,
1235
1207
}
1236
1208
. to_tokens ( into) ;
@@ -1242,7 +1214,6 @@ impl ToTokens for ast::ImportStatic {
1242
1214
struct Descriptor < ' a , T > {
1243
1215
ident : & ' a Ident ,
1244
1216
inner : T ,
1245
- unstable_api : bool ,
1246
1217
attrs : Vec < syn:: Attribute > ,
1247
1218
}
1248
1219
@@ -1271,7 +1242,6 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> {
1271
1242
}
1272
1243
1273
1244
let name = Ident :: new ( & format ! ( "__wbindgen_describe_{}" , ident) , ident. span ( ) ) ;
1274
- let unstable_api_attr = util:: maybe_unstable_api_attr ( self . unstable_api ) ;
1275
1245
let inner = & self . inner ;
1276
1246
let attrs = & self . attrs ;
1277
1247
( quote ! {
@@ -1281,7 +1251,6 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> {
1281
1251
#[ doc( hidden) ]
1282
1252
#[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ]
1283
1253
#[ allow( clippy:: all) ]
1284
- #unstable_api_attr
1285
1254
pub extern "C" fn #name( ) {
1286
1255
use wasm_bindgen:: describe:: * ;
1287
1256
// See definition of `link_mem_intrinsics` for what this is doing
0 commit comments