Miri detected UB in how we were freeing Arcs. We were first creating a reference from the passed-in pointer, then passing that reference as input to Arc::from_raw, which by implicit conversion turned it back into a *const Foo.
Not only was this unnecessary, it is UB according to Stacked Borrows: the reference created a SharedReadOnly tag on the stack; but dropping the Arc requires SharedReadWrite because it decrements the ref count.
Miri detected UB in how we were freeing Arcs. We were first creating a reference from the passed-in pointer, then passing that reference as input to Arc::from_raw, which by implicit conversion turned it back into a
*const Foo
.Not only was this unnecessary, it is UB according to Stacked Borrows: the reference created a SharedReadOnly tag on the stack; but dropping the Arc requires SharedReadWrite because it decrements the ref count.