projects
/
web.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e72625e
)
less wide comments
author
Ralf Jung
<post@ralfj.de>
Thu, 2 May 2019 11:10:40 +0000
(13:10 +0200)
committer
Ralf Jung
<post@ralfj.de>
Thu, 2 May 2019 11:10:40 +0000
(13:10 +0200)
personal/_posts/2019-04-30-stacked-borrows-2.md
patch
|
blob
|
history
diff --git
a/personal/_posts/2019-04-30-stacked-borrows-2.md
b/personal/_posts/2019-04-30-stacked-borrows-2.md
index dec44ed4fa1cc1f49b9184ffd11db8e2c19e2181..5f13b3d13b4ecb719debda19108cf06ede9d5d6a 100644
(file)
--- a/
personal/_posts/2019-04-30-stacked-borrows-2.md
+++ b/
personal/_posts/2019-04-30-stacked-borrows-2.md
@@
-35,7
+35,7
@@
fn foo(a: &mut u32, y: *mut u32) -> u32 {
*a = 1;
let _b = &*a; // This freezes `*a`. Frozen locations can be read by any raw pointer.
let _val = unsafe { *y; }; // Hence, this legal in Stacked Borrows.
*a = 1;
let _b = &*a; // This freezes `*a`. Frozen locations can be read by any raw pointer.
let _val = unsafe { *y; }; // Hence, this legal in Stacked Borrows.
- *a = 2; // But we might want to drop the earlier `*a = 1` because it gets overwritten
by this
!
+ *a = 2; // But we might want to drop the earlier `*a = 1` because it gets overwritten!
_val
}
{% endhighlight %}
_val
}
{% endhighlight %}