1 // Can't put mut in non-ident pattern
5 #![feature(box_patterns)]
9 let mut _ = 0; //~ ERROR `mut` must be followed by a named binding
10 let mut (_, _) = (0, 0); //~ ERROR `mut` must be followed by a named binding
12 let mut (x @ y) = 0; //~ ERROR `mut` must be attached to each individual binding
15 //~^ ERROR `mut` on a binding may not be repeated
16 //~| remove the additional `mut`s
18 struct Foo { x: isize }
19 let mut Foo { x: x } = Foo { x: 3 };
20 //~^ ERROR `mut` must be attached to each individual binding
21 //~| add `mut` to each binding
23 let mut Foo { x } = Foo { x: 3 };
24 //~^ ERROR `mut` must be attached to each individual binding
25 //~| add `mut` to each binding
27 struct r#yield(u8, u8);
28 let mut mut yield(become, await) = r#yield(0, 0);
29 //~^ ERROR `mut` on a binding may not be repeated
30 //~| ERROR `mut` must be attached to each individual binding
31 //~| ERROR expected identifier, found reserved keyword `yield`
32 //~| ERROR expected identifier, found reserved keyword `become`
33 //~| ERROR expected identifier, found keyword `await`
36 struct B { f: Box<u8> }
37 let mut W(mut a, W(b, W(ref c, W(d, B { box f }))))
38 //~^ ERROR `mut` must be attached to each individual binding
39 = W(0, W(1, W(2, W(3, B { f: Box::new(4u8) }))));
41 // Make sure we don't accidentally allow `mut $p` where `$p:pat`.
44 let mut $p = 0; //~ ERROR expected identifier, found `x`