From 05b8dfd1527811f3a183784bbf36c6d3cab90349 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 6 Apr 2018 13:13:33 +0200 Subject: [PATCH] clarify changed init signature --- personal/_posts/2018-04-05-a-formal-look-at-pinning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/personal/_posts/2018-04-05-a-formal-look-at-pinning.md b/personal/_posts/2018-04-05-a-formal-look-at-pinning.md index 98e0477..98b53a1 100644 --- a/personal/_posts/2018-04-05-a-formal-look-at-pinning.md +++ b/personal/_posts/2018-04-05-a-formal-look-at-pinning.md @@ -89,7 +89,7 @@ fn main() { The most intersting piece of code here is `read_ref`, which dereferences a raw pointer. The reason this is legal is that we can rely on the entire `SelfReferential` not having been moved since `init()` was called (which is the only place that would set the pointer to `Some`). -In particular, if we changed the signature of `init()` to take `&mut`, we could easily cause UB by writing the following code: +In particular, if we changed the signature to `fn init(&mut self)`, we could easily cause UB by writing the following code: {% highlight rust %} fn main() { // Create an initialize a SelfReferential in a Box, move it out, and drop the Box -- 2.30.2