1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Tests how we behave when the user attempts to mutate an immutable
12 // binding that was introduced by either `ref` or `ref mut`
15 // Such bindings cannot be made mutable via the mere addition of the
16 // `mut` keyword, and thus we want to check that the compiler does not
20 let (mut one_two, mut three_four) = ((1, 2), (3, 4));
21 let &mut (ref a, ref mut b) = &mut one_two;
23 //~^ ERROR cannot assign twice to immutable variable `a` [E0384]
24 b = &mut three_four.1;
25 //~^ ERROR cannot assign twice to immutable variable `b` [E0384]