Skip to content

Commit e262856

Browse files
add test for earlier drop despite extend lifetime
1 parent 0244355 commit e262856

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/ui/let-else/let-else-temporary-lifetime.rs

+11
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ fn main() {
7474
};
7575
}
7676
}
77+
{
78+
fn must_pass() {
79+
let rc = Rc::new(());
80+
let &None = &Some(Rc::clone(&rc)) else {
81+
Rc::try_unwrap(rc).unwrap();
82+
return;
83+
};
84+
unreachable!();
85+
}
86+
must_pass();
87+
}
7788
{
7889
// test let-else drops temps before else block
7990
// NOTE: this test has to be the last block in the `main`

0 commit comments

Comments
 (0)