From 51573c9e72cdac588919069d7aaba9224ff7f723 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 23 Jul 2022 21:27:57 +0200 Subject: [PATCH] add note about mutation uniqueness --- content/posts/box-is-a-unique-type.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/posts/box-is-a-unique-type.md b/content/posts/box-is-a-unique-type.md index 746ea4f..9a470d4 100644 --- a/content/posts/box-is-a-unique-type.md +++ b/content/posts/box-is-a-unique-type.md @@ -206,6 +206,10 @@ having to write their own. Interestingly, this crate also provides a `Vec`, e in the current version of stacked borrows. just fine, although it's also not clear whether we want to keep it like this, but I don't think this can reasonable be changed. +> One thing was just pointed out to me after releasing the post: Mutation usually goes through `&mut T` anyways, even when the value +> is stored as a `Box`. Therefore, all the guarantees of uniqueness are already present when mutating boxes, making the uniqueness +> of box even less important. + # noalias, noslow There is one clear potential benefit from this box behaviour: ✨Optimizations✨. `noalias` doesn't exist for fun, it's something