]> git.proxmox.com Git - rustc.git/blame - src/test/mir-opt/issue-43457.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / test / mir-opt / issue-43457.rs
CommitLineData
3b2f2976
XL
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.
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
ea8adc8c 11// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions
3b2f2976
XL
12// ignore-tidy-linelength
13
14// Regression test for #43457: an `EndRegion` was missing from output
15// because compiler was using a faulty means for region map lookup.
16
17use std::cell::RefCell;
18
19fn rc_refcell_test(r: RefCell<i32>) {
20 r.borrow_mut();
21}
22
23fn main() { }
24
25// END RUST SOURCE
abe05a73 26// START rustc.rc_refcell_test.SimplifyCfg-qualify-consts.after.mir
3b2f2976
XL
27//
28// fn rc_refcell_test(_1: std::cell::RefCell<i32>) -> () {
29// let mut _0: ();
30// scope 1 {
31// let _2: std::cell::RefCell<i32>;
32// }
ea8adc8c
XL
33// let mut _3: std::cell::RefMut<'17ds, i32>;
34// let mut _4: &'17ds std::cell::RefCell<i32>;
3b2f2976
XL
35//
36// bb0: {
37// StorageLive(_2);
38// _2 = _1;
39// StorageLive(_4);
ea8adc8c 40// _4 = &'17ds _2;
3b2f2976
XL
41// _3 = const <std::cell::RefCell<T>>::borrow_mut(_4) -> bb1;
42// }
43//
44// bb1: {
45// drop(_3) -> bb2;
46// }
47//
48// bb2: {
49// StorageDead(_4);
ea8adc8c 50// EndRegion('17ds);
3b2f2976
XL
51// _0 = ();
52// StorageDead(_2);
53// return;
54// }
55// }