1 // Copyright 2012-2016 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 // Basic test for liveness constraints: the region (`R1`) that appears
12 // in the type of `p` includes the points after `&v[0]` up to (but not
13 // including) the call to `use_x`. The `else` branch is not included.
15 // compile-flags:-Zborrowck=compare
18 #![feature(rustc_attrs)]
28 let mut my_struct
= MyStruct { field: format!("Hello") }
;
30 let value
= &mut my_struct
.field
;
32 my_struct
.field
.push_str("Hello, world!");
33 //~^ ERROR (Ast) [E0499]
34 //~| ERROR (Mir) [E0499]
41 let mut my_struct
= MyStruct { field: format!("Hello") }
;
43 let value
= &mut my_struct
.field
;
45 my_struct
.field
.push_str("Hello, world!");
46 //~^ ERROR (Ast) [E0499]