Closed
Description
e.g.
let (mut x, mut y) = ...;
match p {
Foo(mut q) => { ... }
mut s @ Baz(*) => { ... }
}
fn foo((mut a, mut b): (~str, ~[float])) { ... }
let f = |mut x| { ... };
The grammar would become approximately
ident_pat = "ref"? "mut"? ident
pat = "_"
| ident_pat
| path "(" "*" ")"
| path "(" pat* ")"
| path "{" [ident ":" pat | ident^]* "}"
| ident_pat "@" pat
(The ident
marked ^
would become a ident_pat
to solve #6137.)
This would also mean that the grammar for let
could be simplified to just "let" pat "=" expr ";"
(rather than "let" "mut"? pat "=" expr ";"
as it currently is), and similarly for function arguments.
(I think this has been thrown about for a while, but I can't find an issue; and I very briefly experimented with this, but quite a few places seem to assume that only let
and function args allow mut
.)