Closed
Description
While watching yesterday's live stream Box shallow copying was mentioned, and me and a couple viewers asked about aliasing
I asked in the UFC zulip stream about it
Quoting RalfJ:
RalfJ: it's more that Box is an exclusive ptr and even reads
through aliases are disallowed when a ptr is exclusive
RalfJ: (this grants extra optimization power because it means
nobody else can even observe the current value stored behind the ptr)
Example which triggers UB according to MIRI (As provided by bjorn3 in the zulip topic)
Even just making a shared reference instead of actually reading the Copy value also triggers UB according to MIRI
Changing it to make the shallow copy the same way as the Box<T> shallow copy impl seems to change nothing: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6e7b08eb28d6032fbdb41028225f4dde
Metadata
Metadata
Assignees
Labels
No labels