Open
Description
This came up in rust-lang/rust#111502 and overlaps with #257: should it be allowed to mutate let
-bound variables, via code like this?
let x = 0i32;
let ptr = addr_of!(x) as *mut i32;
*ptr = 42;
Tree Borrows currently accepts this code since addr_of
never generates a new tag, it just creates an alias to the original pointer. Stacked Borrows rejects it due to #257. There are other ways to reject this code while making *const
and *mut
equivalent, hence I opened this as a separate issue.
Personally I favor the Tree Borrows behavior here and don't think it is worth the extra effort to make these variables read-only.