1 // Copyright 2012-2014 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 #![allow(unused_variable)]
12 #![allow(dead_assignment)]
14 fn cond() -> bool { fail!() }
15 fn link<'a>(v: &'a uint, w: &mut &'a uint) -> bool { *w = v; true }
18 // Here both arms perform assignments, but only is illegal.
23 // It is ok to reassign x here, because there is in
24 // fact no outstanding loan of x!
28 x = Some(1i); //~ ERROR cannot assign
31 x.clone(); // just to prevent liveness warnings
35 // Here the guard performs a borrow. This borrow "infects" all
36 // subsequent arms (but not the prior ones).
46 _ if link(&*b, &mut w) => {
47 b = box 6u; //~ ERROR cannot assign
51 b = box 7u; //~ ERROR cannot assign
55 b = box 8; //~ ERROR cannot assign