[rust-dev] Why doesn't rust require "mut" param prefix at call site?

comex comexk at gmail.com
Wed Jan 1 17:07:53 PST 2014


On Wed, Jan 1, 2014 at 6:49 PM, Martin Olsson <martin at minimum.se> wrote:
> Short version of my question:
>
> Why doesn't rust require "mut" param prefix at call sites? i.e. to avoid
> "non-const ref badness" that C++ has?

Well, to be somewhat extreme, in a function like

struct S { a: &mut int, b: &mut int }
fn f(s: &mut &mut S) ...
fn g(s: &mut &mut S) { f(s) }

what sort of "mut"s does g need?


More information about the Rust-dev mailing list