]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-17263.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-17263.rs
1 // Copyright 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.
4 //
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.
10
11 #![feature(box_syntax, rustc_attrs)]
12
13 struct Foo { a: isize, b: isize }
14
15 fn main() { #![rustc_error] // rust-lang/rust#49855
16     let mut x: Box<_> = box Foo { a: 1, b: 2 };
17     let (a, b) = (&mut x.a, &mut x.b);
18     //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
19
20     let mut foo: Box<_> = box Foo { a: 1, b: 2 };
21     let (c, d) = (&mut foo.a, &foo.b);
22     //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
23 }