Closed
Description
Currently, the following code works:
let x = RefCell::new(true);
if *x.borrow() {
x.borrow_mut();
}
but this panics:
let x = RefCell::new(true);
match *x.borrow() {
_ => { x.borrow_mut(); }
}
(playpen)
Due to #12033 (implemented in #36029) we free temporaries from if
conditions.
We should also free temporaries in match subjects if there are no active borrows from them.
This would be semantically a [breaking change]. I do not think it will change how things compile. I am not sure if we need an rfc for this because IMO the fact that this doesn't work is a bug.