Skip to content

let-else: break out to one scope higher for let-else #99954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test for earlier drop despite extend lifetime
  • Loading branch information
dingxiangfei2009 committed Jul 31, 2022
commit e26285603ca8b83b9d06e56f74e10e3d410553ff
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