@@ -16,7 +16,7 @@ use crate::models::domain::{
16
16
BuiltinClass , BuiltinMethod , BuiltinVariant , Class , ClassCodegenLevel , ClassLike , ClassMethod ,
17
17
ExtensionApi , FnDirection , Function , TyName ,
18
18
} ;
19
- use crate :: util:: ident;
19
+ use crate :: util:: { ident, make_load_safety_doc } ;
20
20
use crate :: { conv, generator, special_cases, util} ;
21
21
22
22
pub fn make_builtin_lifecycle_table ( api : & ExtensionApi ) -> TokenStream {
@@ -276,6 +276,7 @@ fn make_named_method_table(info: NamedMethodTable) -> TokenStream {
276
276
277
277
// Assumes that both decls and inits already have a trailing comma.
278
278
// This is necessary because some generators emit multiple lines (statements) per element.
279
+ let safety_doc = make_load_safety_doc ( ) ;
279
280
quote ! {
280
281
#imports
281
282
@@ -288,9 +289,7 @@ fn make_named_method_table(info: NamedMethodTable) -> TokenStream {
288
289
pub const CLASS_COUNT : usize = #class_count;
289
290
pub const METHOD_COUNT : usize = #method_count;
290
291
291
- // TODO: Figure out the right safety preconditions. This currently does not have any because incomplete safety docs
292
- // can cause issues with people assuming they are sufficient.
293
- #[ allow( clippy:: missing_safety_doc) ]
292
+ #safety_doc
294
293
pub unsafe fn load(
295
294
#ctor_parameters
296
295
) -> Self {
@@ -374,6 +373,7 @@ fn make_method_table(info: IndexedMethodTable) -> TokenStream {
374
373
375
374
// Assumes that inits already have a trailing comma.
376
375
// This is necessary because some generators emit multiple lines (statements) per element.
376
+ let safety_doc = make_load_safety_doc ( ) ;
377
377
quote ! {
378
378
#imports
379
379
@@ -387,9 +387,7 @@ fn make_method_table(info: IndexedMethodTable) -> TokenStream {
387
387
pub const CLASS_COUNT : usize = #class_count;
388
388
pub const METHOD_COUNT : usize = #method_count;
389
389
390
- // TODO: Figure out the right safety preconditions. This currently does not have any because incomplete safety docs
391
- // can cause issues with people assuming they are sufficient.
392
- #[ allow( clippy:: missing_safety_doc) ]
390
+ #safety_doc
393
391
#unused_attr
394
392
pub unsafe fn load(
395
393
#ctor_parameters
@@ -440,6 +438,7 @@ fn make_method_table(info: IndexedMethodTable) -> TokenStream {
440
438
441
439
// Assumes that inits already have a trailing comma.
442
440
// This is necessary because some generators emit multiple lines (statements) per element.
441
+ let safety_doc = make_load_safety_doc ( ) ;
443
442
quote ! {
444
443
#imports
445
444
use crate :: StringCache ;
@@ -462,9 +461,7 @@ fn make_method_table(info: IndexedMethodTable) -> TokenStream {
462
461
pub const CLASS_COUNT : usize = #class_count;
463
462
pub const METHOD_COUNT : usize = #method_count;
464
463
465
- // TODO: Figure out the right safety preconditions. This currently does not have any because incomplete safety docs
466
- // can cause issues with people assuming they are sufficient.
467
- #[ allow( clippy:: missing_safety_doc) ]
464
+ #safety_doc
468
465
#unused_attr
469
466
pub unsafe fn load( ) -> Self {
470
467
// SAFETY: interface and lifecycle tables are initialized at this point, so we can get 'static references to them.
0 commit comments