]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/region-ends-after-if-condition.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / nll / region-ends-after-if-condition.rs
CommitLineData
abe05a73
XL
1// Basic test for liveness constraints: the region (`R1`) that appears
2// in the type of `p` includes the points after `&v[0]` up to (but not
3// including) the call to `use_x`. The `else` branch is not included.
4
abe05a73
XL
5#![allow(warnings)]
6#![feature(rustc_attrs)]
7
8struct MyStruct {
9 field: String
10}
11
12fn foo1() {
13 let mut my_struct = MyStruct { field: format!("Hello") };
14
15 let value = &my_struct.field;
16 if value.is_empty() {
17 my_struct.field.push_str("Hello, world!");
abe05a73
XL
18 }
19}
20
21fn foo2() {
22 let mut my_struct = MyStruct { field: format!("Hello") };
23
24 let value = &my_struct.field;
25 if value.is_empty() {
26 my_struct.field.push_str("Hello, world!");
48663c56 27 //~^ ERROR [E0502]
abe05a73
XL
28 }
29 drop(value);
30}
31
32fn main() { }