Skip to content

Commit 880405c

Browse files
committed
Make code work
1 parent 72fd033 commit 880405c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/types/closure.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,16 @@ If a closure captures a field of a composite types such as structs, tuples, and
385385
### box-mut
386386

387387
```rust
388+
struct Foo { x: i32 }
389+
388390
fn box_mut() {
389391
let mut s = Foo { x: 0 } ;
390392

391393
let px = &mut s;
392394
let bx = Box::new(px);
393395

394396

395-
let c = #[rustc_capture_analysis] move || bx.x += 10;
397+
let c = move || bx.x += 10;
396398
// Mutable reference to this place:
397399
// (*(*bx)).x
398400
// ^ ^
@@ -401,7 +403,8 @@ fn box_mut() {
401403
}
402404
```
403405

404-
```
406+
<!-- ignore: Omit error about unterminated string literal when representing c_prime -->
407+
```ignore
405408
Closure mode = move
406409
C = {
407410
(ref mut, (*(*bx)).x)
@@ -434,7 +437,8 @@ fn main() {
434437
}
435438
```
436439

437-
```
440+
<!-- ignore: Omit error about unterminated string literal when representing c_prime -->
441+
```ignore
438442
Closure mode = ref
439443
C = {
440444
(ref mut, packed)
@@ -443,7 +447,7 @@ C' = C
443447
```
444448

445449
### Optimization-Edge-Case
446-
```rust
450+
```edition2021
447451
struct Int(i32);
448452
struct B<'a>(&'a i32);
449453
@@ -459,7 +463,8 @@ fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static {
459463
460464
```
461465

462-
```
466+
<!-- ignore: Omit error about unterminated string literal when reprenting c_prime -->
467+
```ignore
463468
Closure mode = ref
464469
C = {
465470
(ref mut, *m.a)

0 commit comments

Comments
 (0)