Skip to content

Commit 61d9d17

Browse files
Diggseytaiki-e
authored andcommitted
Implement workaround for compiler bug
1 parent 9f74f61 commit 61d9d17

File tree

1 file changed

+10
-2
lines changed
  • pin-project-internal/src/pin_project

1 file changed

+10
-2
lines changed

pin-project-internal/src/pin_project/derive.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,11 @@ impl<'a> Context<'a> {
424424
};
425425

426426
// Now create guards to drop all the pinned fields
427-
#proj_drop
427+
//
428+
// Due to a compiler bug (https://github.com/rust-lang/rust/issues/47949)
429+
// this must be in its own scope, or else `__result` will not be dropped
430+
// if any of the destructors panic.
431+
{ #proj_drop }
428432

429433
// Finally, return the result
430434
__result
@@ -555,7 +559,11 @@ impl<'a> Context<'a> {
555559
};
556560

557561
// Now create guards to drop all the pinned fields
558-
#proj_drop
562+
//
563+
// Due to a compiler bug (https://github.com/rust-lang/rust/issues/47949)
564+
// this must be in its own scope, or else `__result` will not be dropped
565+
// if any of the destructors panic.
566+
{ #proj_drop }
559567

560568
// Finally, return the result
561569
__result

0 commit comments

Comments
 (0)