scovich commented on PR #7843:
URL: https://github.com/apache/arrow-rs/pull/7843#issuecomment-3032633370

   > > **Against**: Outside unit tests, recursive builders will almost always 
live in a nested scope vs. their parent -- usually a called function or method, 
or at least a `match` clause -- which would trivially defeat the drop sentinel.
   > 
   > I don't understand what you mean by defeat the drop sentinel. Since the 
`ObjectBuilder` has a `mut` reference to its parent, I don't think the rust 
compiler will allow anything to the same underlying parent builder
   > 
   > Maybe I am missing something here and an example would help 🤔
   
   From what I understood, the example you gave above would trivially defeat an 
`impl Drop` sentinel (= empty `drop` method), because the `object_builder` goes 
out of scope before the call to `list_builder.finish()`:
   ```rust
           let mut builder = VariantBuilder::new();
           let mut list_builder = builder.new_list();
   
           {
               let mut object_builder = list_builder.new_object();
               object_builder.insert("id", 1);
               // NOTE object_builder.finish() is not called here
           }
   
           list_builder.finish();
           let (metadata, value) = builder.finish();        
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to