Within a single function we are more permissive, I think. I've been debating if we should stop that, just for consistency. There are also some bugs concerning closures. I hope to close those soon with my patch for #6801.
On Wed, Jan 29, 2014 at 02:39:01PM -0800, Vadim wrote: > I've tried to simulate that with iterators, but it seems I can still read > the buffer. This compiles without errors: > > let mut buf = [0, ..1024]; > let mut iter = buf.mut_iter(); > let x = buf[0]; > *iter.next().unwrap() = 2; // just to make sure I can mutate via the > iterator > > > > > On Wed, Jan 29, 2014 at 2:06 PM, Daniel Micay <[email protected]> wrote: > > > On Wed, Jan 29, 2014 at 5:03 PM, Vadim <[email protected]> wrote: > > > > > > But maybe Rust type system could grow a new type of borrow that prevents > > all > > > object access while it is in scope, similarly to how iterators prevent > > > mutation of the container being iterated? > > > > > > Vadim > > > > An `&mut` borrow will prevent reads not through that borrow. > > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
