Given a value of a Drop type that is conditionally moved on one branch, how does rustc ensure the destructor runs exactly once across both paths at the end of the function?
struct Res(String);
impl Drop for Res {
fn drop(&mut self) { println!("drop"); }
}
fn consume(r: Res) {}
fn maybe(flag: bool) {
let r = Res(String::from("x"));
if flag {
consume(r);
}
}