Warning
This post was published 31 days ago. The information described in this article may have changed.
Given a function, or closure, there are drop scopes for:
- The entire function
- Each statement
- Each expression
- Each block, including the function body
- In the case of a block expression, the scope for the block and the expression are the same scope.
fn main(){
let i = String::from("i");
let f = move ||{
println!("{i}");
};
}
It is unclear what the drop scope of the captured variable i
is.
5 posts - 2 participants
🏷️ rust_feed