Closed
Description
The following code
fn rc_refcell_test(r: RefCell<i32>) {
r.borrow_mut();
}
compiles to MIR without any EndRegion
(this is right before the EraseRegions
pass):
// MIR for `rc_refcell_test`
// source = Fn(NodeId(54))
// pass_name = EraseRegions
// disambiguator = before
fn rc_refcell_test(_1: std::cell::RefCell<i32>) -> () {
let mut _0: (); // return pointer
scope 1 {
let _2: std::cell::RefCell<i32>; // "r" in scope 1 at ../tests/run-pass/std.rs:19:20: 19:21
}
let mut _3: std::cell::RefMut<ReScope(DestructionScope(NodeId(259))), i32>;
let mut _4: &ReScope(DestructionScope(NodeId(259))) std::cell::RefCell<i32>;
bb0: {
StorageLive(_2); // scope 0 at ../tests/run-pass/std.rs:19:20: 19:21
_2 = _1; // scope 0 at ../tests/run-pass/std.rs:19:20: 19:21
StorageLive(_4); // scope 1 at ../tests/run-pass/std.rs:20:5: 20:6
_4 = &ReScope(DestructionScope(NodeId(259))) _2; // scope 1 at ../tests/run-pass/std.rs:20:5: 20:6
_3 = const <std::cell::RefCell<T>>::borrow_mut(_4) -> bb1; // scope 1 at ../tests/run-pass/std.rs:20:5: 20:19
}
bb1: {
drop(_3) -> bb2; // scope 1 at ../tests/run-pass/std.rs:20:5: 20:19
}
bb2: {
StorageDead(_4); // scope 1 at ../tests/run-pass/std.rs:20:19: 20:19
_0 = (); // scope 1 at ../tests/run-pass/std.rs:19:37: 21:2
StorageDead(_2); // scope 0 at ../tests/run-pass/std.rs:21:2: 21:2
return; // scope 1 at ../tests/run-pass/std.rs:21:2: 21:2
}
}
Cc @pnkfelix