@@ -518,7 +518,8 @@ macro_rules! __pinned_drop {
518518 }
519519 ) ,
520520 ) => {
521- // SAFETY: TODO.
521+ // SAFETY: The `OnlyCallFromDrop` token ensures the drop function can only be called
522+ // when the struct is properly pinned.
522523 unsafe $( $impl_sig) * {
523524 // Inherit all attributes and the type/ident tokens for the signature.
524525 $( #[ $( $attr) * ] ) *
@@ -878,7 +879,8 @@ macro_rules! __pin_data {
878879 }
879880 }
880881
881- // SAFETY: TODO.
882+ // SAFETY: `__ThePinData` correctly represents the pinning structure of the original type
883+ // and the associated type `Datee` correctly refers to the original struct type.
882884 unsafe impl <$( $impl_generics) * >
883885 $crate:: __internal:: PinData for __ThePinData<$( $ty_generics) * >
884886 where $( $whr) *
@@ -1005,7 +1007,7 @@ macro_rules! __pin_data {
10051007 slot: * mut $p_type,
10061008 init: impl $crate:: PinInit <$p_type, E >,
10071009 ) -> :: core:: result:: Result <( ) , E > {
1008- // SAFETY: TODO .
1010+ // SAFETY: `slot` points to valid, uninitialized memory for a `$p_type` .
10091011 unsafe { $crate:: PinInit :: __pinned_init( init, slot) }
10101012 }
10111013 ) *
@@ -1016,7 +1018,7 @@ macro_rules! __pin_data {
10161018 slot: * mut $type,
10171019 init: impl $crate:: Init <$type, E >,
10181020 ) -> :: core:: result:: Result <( ) , E > {
1019- // SAFETY: TODO .
1021+ // SAFETY: `slot` points to valid, uninitialized memory for a `$type` .
10201022 unsafe { $crate:: Init :: __init( init, slot) }
10211023 }
10221024 ) *
@@ -1132,7 +1134,8 @@ macro_rules! __init_internal {
11321134 struct __InitOk;
11331135 // Get the data about fields from the supplied type.
11341136 //
1135- // SAFETY: TODO.
1137+ // SAFETY: The `$get_data()` function only returns metadata about the type's pinning structure.
1138+ // No memory is accessed, only type-level information is retrieved.
11361139 let data = unsafe {
11371140 use $crate:: __internal:: $has_data;
11381141 // Here we abuse `paste!` to retokenize `$t`. Declarative macros have some internal
@@ -1188,7 +1191,8 @@ macro_rules! __init_internal {
11881191 let init = move |slot| -> :: core:: result:: Result <( ) , $err> {
11891192 init( slot) . map( |__InitOk| ( ) )
11901193 } ;
1191- // SAFETY: TODO.
1194+ // SAFETY: The closure property initializes the target memory location. Error handling
1195+ // ensures memory is left in a valid state if initialization fails.
11921196 let init = unsafe { $crate:: $construct_closure:: <_, $err>( init) } ;
11931197 init
11941198 } } ;
@@ -1338,7 +1342,8 @@ macro_rules! __init_internal {
13381342 // Since we are in the closure that is never called, this will never get executed.
13391343 // We abuse `slot` to get the correct type inference here:
13401344 //
1341- // SAFETY: TODO.
1345+ // SAFETY: This is unreachable code that is used solely for compile-time type checking,
1346+ // it is never executed.
13421347 unsafe {
13431348 // Here we abuse `paste!` to retokenize `$t`. Declarative macros have some internal
13441349 // information that is associated to already parsed fragments, so a path fragment
0 commit comments