add test for earlier drop despite extend lifetime · rust-lang/rust@e262856 (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit e262856
add test for earlier drop despite extend lifetime
File tree
1 file changed
lines changed
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -74,6 +74,17 @@ fn main() { | ||
74 | 74 | }; |
75 | 75 | } |
76 | 76 | } |
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 | +} | |
77 | 88 | { |
78 | 89 | // test let-else drops temps before else block |
79 | 90 | // NOTE: this test has to be the last block in the `main` |