Skip to content

Commit

Permalink
book: Fix static lifetime typo
Browse files Browse the repository at this point in the history
Fixes #1698
  • Loading branch information
bilelmoussaoui committed May 31, 2024
1 parent f1365cd commit 3826b9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion book/src/g_object_memory_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ help: to force the closure to take ownership of `number` (and any other referenc
```

Our closure only borrows `number`.
Signal handlers in GTK require `static'` lifetimes for their references, so we cannot borrow a variable that only lives for the scope of the function `build_ui`.
Signal handlers in GTK require `'static` lifetimes for their references, so we cannot borrow a variable that only lives for the scope of the function `build_ui`.
The compiler also suggests how to fix this.
By adding the `move` keyword in front of the closure, `number` will be moved into the closure.

Expand Down

0 comments on commit 3826b9a

Please sign in to comment.