File tree 1 file changed +10
-2
lines changed 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -678,6 +678,14 @@ impl TryToTokens for ast::Export {
678
678
} ;
679
679
let nargs = self . function . arguments . len ( ) as u32 ;
680
680
let attrs = & self . function . rust_attrs ;
681
+ let safe_attrs = attrs
682
+ . iter ( )
683
+ . filter ( |a| {
684
+ let path = a. path ( ) ;
685
+ path. is_ident ( "cfg" ) || path. is_ident ( "cfg_attr" )
686
+ } )
687
+ . cloned ( )
688
+ . collect :: < Vec < _ > > ( ) ;
681
689
682
690
let start_check = if self . start {
683
691
quote ! { const _ASSERT: fn ( ) = || -> #projection:: Abi { loop { } } ; }
@@ -688,7 +696,7 @@ impl TryToTokens for ast::Export {
688
696
( quote ! {
689
697
#[ automatically_derived]
690
698
const _: ( ) = {
691
- #( #attrs ) *
699
+ #( #safe_attrs ) *
692
700
#[ cfg_attr(
693
701
all( target_arch = "wasm32" , not( any( target_os = "emscripten" , target_os = "wasi" ) ) ) ,
694
702
export_name = #export_name,
@@ -745,7 +753,7 @@ impl TryToTokens for ast::Export {
745
753
#describe_args
746
754
#describe_ret
747
755
} ,
748
- attrs : attrs . clone ( ) ,
756
+ attrs : safe_attrs ,
749
757
wasm_bindgen : & self . wasm_bindgen ,
750
758
}
751
759
. to_tokens ( into) ;
You can’t perform that action at this time.
0 commit comments