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 // compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions
12 // ignore-tidy-linelength
14 // Unwinding should EndRegion for in-scope borrows: Borrow of moved data.
18 foo(move || -> i32 { let r = &d; r.0 });
22 impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } }
24 fn foo<F>(f: F) where F: FnOnce() -> i32 {
25 if f() > 0 { panic!("im positive"); }
29 // START rustc.main.SimplifyCfg-qualify-consts.after.mir
36 // let mut _3: [closure@NodeId(22) d:D];
40 // _1 = D::{{constructor}}(const 0i32,);
44 // _3 = [closure@NodeId(22)] { d: _4 };
45 // drop(_4) -> [return: bb4, unwind: bb3];
58 // _2 = const foo(_3) -> [return: bb5, unwind: bb3];
61 // drop(_3) -> [return: bb6, unwind: bb2];
73 // END rustc.main.SimplifyCfg-qualify-consts.after.mir
75 // START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir
76 // fn main::{{closure}}(_1: [closure@NodeId(22) d:D]) -> i32 {
79 // let _2: &'15_0rs D;
84 // _2 = &'15_0rs (_1.0: D);
86 // _3 = ((*_2).0: i32);
89 // EndRegion('15_0rs);
97 // END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir