3 ms·
I'm not sure about your first example—the formatting seems messed up—but the second example is solved with dynamic borrow checking.
by pcwalton 13y ago
I'm not sure about your first example—the formatting seems messed up—but the second example is solved with dynamic borrow checking.
- dbaupp 13y agoOh, yes, HN replaced * with italics. I was talking about raw pointers, i.e. the second example is: f(&mut x as *mut u8, &mut x) and there is no dynamic borrowing checking for that. Would it become some form of undefined behaviour to have an *mut aliasing with an &mut?
- pcwalton 13y agoNah, I think we can handle it without undefined behavior by telling LLVM that `﹡mut` can alias anything. In effect, we would only tell LLVM that `&mut T` cannot alias `&mut T` if there is no `﹡mut T` in scope. Of course, if you transmute stuff into `&mut T`, then you'd better make sure that those two `&mut T`s don't overlap. But `﹡mut T` should be fine.