Skip to content

Commit

Permalink
add test for earlier drop despite extend lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Jul 31, 2022
1 parent 0244355 commit e262856
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/ui/let-else/let-else-temporary-lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ fn main() {
};
}
}
{
fn must_pass() {
let rc = Rc::new(());
let &None = &Some(Rc::clone(&rc)) else {
Rc::try_unwrap(rc).unwrap();
return;
};
unreachable!();
}
must_pass();
}
{
// test let-else drops temps before else block
// NOTE: this test has to be the last block in the `main`
Expand Down

0 comments on commit e262856

Please sign in to comment.