diff --git a/src/types/closure.md b/src/types/closure.md index 9229e8106..ed5744717 100644 --- a/src/types/closure.md +++ b/src/types/closure.md @@ -385,6 +385,8 @@ If a closure captures a field of a composite types such as structs, tuples, and ### box-mut ```rust +struct Foo { x: i32 } + fn box_mut() { let mut s = Foo { x: 0 } ; @@ -392,7 +394,7 @@ fn box_mut() { let bx = Box::new(px); - let c = #[rustc_capture_analysis] move || bx.x += 10; + let c = move || bx.x += 10; // Mutable reference to this place: // (*(*bx)).x // ^ ^ @@ -401,7 +403,8 @@ fn box_mut() { } ``` -``` + +```ignore Closure mode = move C = { (ref mut, (*(*bx)).x) @@ -434,7 +437,8 @@ fn main() { } ``` -``` + +```ignore Closure mode = ref C = { (ref mut, packed) @@ -443,7 +447,7 @@ C' = C ``` ### Optimization-Edge-Case -```rust +```edition2021 struct Int(i32); struct B<'a>(&'a i32); @@ -459,7 +463,8 @@ fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static { ``` -``` + +```ignore Closure mode = ref C = { (ref mut, *m.a)