File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,7 @@ impl ToTokens for ast::Struct {
191
191
192
192
#[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ]
193
193
#[ no_mangle]
194
+ #[ doc( hidden) ]
194
195
pub unsafe extern fn #free_fn( ptr: u32 ) {
195
196
<#name as :: wasm_bindgen:: convert:: FromWasmAbi >:: from_abi(
196
197
ptr,
@@ -246,6 +247,7 @@ impl ToTokens for ast::StructField {
246
247
) ;
247
248
( quote ! {
248
249
#[ no_mangle]
250
+ #[ doc( hidden) ]
249
251
#[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ]
250
252
pub unsafe extern fn #getter( js: u32 )
251
253
-> <#ty as :: wasm_bindgen:: convert:: IntoWasmAbi >:: Abi
@@ -279,6 +281,7 @@ impl ToTokens for ast::StructField {
279
281
280
282
( quote ! {
281
283
#[ no_mangle]
284
+ #[ doc( hidden) ]
282
285
#[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ]
283
286
pub unsafe extern fn #setter(
284
287
js: u32 ,
@@ -441,8 +444,10 @@ impl ToTokens for ast::Export {
441
444
let descriptor_name = Ident :: new ( & descriptor_name, Span :: call_site ( ) ) ;
442
445
let nargs = self . function . arguments . len ( ) as u32 ;
443
446
let argtys = self . function . arguments . iter ( ) . map ( |arg| & arg. ty ) ;
447
+ let attrs = & self . function . rust_attrs ;
444
448
445
449
let tokens = quote ! {
450
+ #( #attrs) *
446
451
#[ export_name = #export_name]
447
452
#[ allow( non_snake_case) ]
448
453
#[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ]
Original file line number Diff line number Diff line change @@ -456,3 +456,52 @@ fn rename_setter_getter() {
456
456
)
457
457
. test ( ) ;
458
458
}
459
+
460
+ #[ test]
461
+ fn deny_missing_docs ( ) {
462
+ project ( )
463
+ . file (
464
+ "src/lib.rs" ,
465
+ r#"
466
+ //! dox
467
+ #![feature(proc_macro, wasm_custom_section, wasm_import_module)]
468
+ #![deny(missing_docs)]
469
+ #![allow(dead_code)]
470
+
471
+ extern crate wasm_bindgen;
472
+
473
+ use wasm_bindgen::prelude::*;
474
+
475
+ /// dox
476
+ #[wasm_bindgen]
477
+ pub struct Bar {
478
+ /// dox
479
+ pub a: u32,
480
+ b: i64,
481
+ }
482
+
483
+ #[wasm_bindgen]
484
+ extern {
485
+ /// dox
486
+ pub type Foo;
487
+
488
+ /// dox
489
+ #[wasm_bindgen(constructor)]
490
+ pub fn new() -> Foo;
491
+
492
+ /// dox
493
+ #[wasm_bindgen(getter = a, method)]
494
+ pub fn test(this: &Foo) -> i32;
495
+
496
+ /// dox
497
+ pub fn foo();
498
+ }
499
+
500
+ /// dox
501
+ #[wasm_bindgen]
502
+ pub fn test() {
503
+ }
504
+ "# ,
505
+ )
506
+ . test ( ) ;
507
+ }
You can’t perform that action at this time.
0 commit comments