File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,21 @@ fn main() {
2929 assert_eq ! ( TRACKER . load( Ordering :: Acquire ) , 1 ) ;
3030 println ! ( "Should have dropped 👆" ) ;
3131
32+ {
33+ // cf. https://github.com/rust-lang/rust/pull/99518#issuecomment-1191520030
34+ struct Foo < ' a > ( & ' a mut u32 ) ;
35+
36+ impl < ' a > Drop for Foo < ' a > {
37+ fn drop ( & mut self ) {
38+ * self . 0 = 0 ;
39+ }
40+ }
41+ let mut foo = 0 ;
42+ let Foo ( 0 ) = Foo ( & mut foo) else {
43+ * & mut foo = 1 ;
44+ todo ! ( )
45+ } ;
46+ }
3247 {
3348 let x = String :: from ( "Hey" ) ;
3449
@@ -61,6 +76,8 @@ fn main() {
6176 }
6277 {
6378 // test let-else drops temps before else block
79+ // NOTE: this test has to be the last block in the `main`
80+ // body.
6481 let rc = Rc :: new ( 0 ) ;
6582 let 1 = * rc. clone ( ) else {
6683 Rc :: try_unwrap ( rc) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments