Does std guarantee that Rc::as_ptr
doesn't create a shared reference to the inside of the Rc
, and hence that it's not immediate UB to mutate through this pointer? This is clearly true as a matter of implementation, see rc.rs - source, but it is not explicitly documented as far as I can tell.
I don't see it listed as an explicit guarantee, but there are definitely things that rely on it, and I don't think they can realistically break this.
Could be worth a PR to document it. Same for into_raw
.
2 Likes