@@ -247,8 +247,8 @@ macro_rules! internal_prudent_unsafe_method {
247247 $( ~expect_unsafe $( { $expect_unsafe_empty_indicator } ) ? ) ?
248248 }
249249 if false {
250- // This block "makes" owned_receiver, an instance/owned value of the same type
251- // as $self. (Of course, the instance is invalid - this is for compile-time
250+ // This block "makes" an owned_receiver, an instance/owned value of the same
251+ // type as $self. (Of course, the instance is invalid - this is for compile-time
252252 // checks only, hence `if false {...}`.)
253253 //
254254 // Then we simulate invocation of the given method inside `unsafe {...}``, BUT
@@ -277,7 +277,7 @@ macro_rules! internal_prudent_unsafe_method {
277277 :: prudent:: unlinted:: shared_to_mut( rref )
278278 } ;
279279 #[ allow( unused_mut) ]
280- #[ allow( invalid_value) ]
280+ #[ allow( invalid_value) ] // for &str and other types where zeroed() issues invalid_value warning.
281281 let mut owned_receiver = :: core:: mem:: replace( mref, unsafe { :: core:: mem:: zeroed( ) } ) ;
282282 // Detect code where unsafe_fn! or unsafe_method! is not needed at all. That is,
283283 // where a function/method used to be `unsafe`, but it stopped being so.
@@ -394,9 +394,10 @@ macro_rules! internal_prudent_unsafe_method_internal_build_accessors_check_args_
394394 ) ?
395395 let result = unsafe {
396396 // Unlike arguments, we can NOT store result of $self expression in a variable, because
397- // it would be moved, but a method with receiver by reference `&self` or `&mut self`
398- // does NOT move the instance it's called on. And if Self were `Copy`, then the
399- // reference would not point to the original instance!
397+ // - it would be moved, but a method with receiver by reference `&self` or `&mut self`
398+ // does NOT move the instance it's called on. Also,
399+ // - if Self were `Copy`, then `&self` or `&mut self` reference would not point to the
400+ // original instance! (Plus extra stack used, plus lifetimes issues.)
400401 $self. $fn( $(
401402 internal_prudent_unsafe_fn_internal_access_tuple_tree_field!{ $tuple_tree, $( $accessor_part) ,+ }
402403 ) ,*
0 commit comments