@@ -66,22 +66,22 @@ control passes to `rust_panic_with_hook`. This method is responsible
6666for invoking the global panic hook, and checking for double panics. Finally,
6767we call ` __rust_start_panic ` , which is provided by the panic runtime.
6868
69- The call to ` __rust_start_panic ` is very weird - it is passed a ` *mut &mut dyn BoxMeUp ` ,
69+ The call to ` __rust_start_panic ` is very weird - it is passed a ` *mut &mut dyn PanicPayload ` ,
7070converted to an ` usize ` . Let's break this type down:
7171
72- 1 . ` BoxMeUp ` is an internal trait. It is implemented for ` PanicPayload `
72+ 1 . ` PanicPayload ` is an internal trait. It is implemented for ` PanicPayload `
7373(a wrapper around the user-supplied payload type), and has a method
74- ` fn box_me_up (&mut self) -> *mut (dyn Any + Send) ` .
74+ ` fn take_box (&mut self) -> *mut (dyn Any + Send) ` .
7575This method takes the user-provided payload (` T: Any + Send ` ),
7676boxes it, and converts the box to a raw pointer.
7777
78- 2 . When we call ` __rust_start_panic ` , we have an ` &mut dyn BoxMeUp ` .
78+ 2 . When we call ` __rust_start_panic ` , we have an ` &mut dyn PanicPayload ` .
7979However, this is a fat pointer (twice the size of a ` usize ` ).
8080To pass this to the panic runtime across an FFI boundary, we take a mutable
81- reference * to this mutable reference* (` &mut &mut dyn BoxMeUp ` ), and convert it to a raw pointer
82- (` *mut &mut dyn BoxMeUp ` ). The outer raw pointer is a thin pointer, since it points to a ` Sized `
83- type (a mutable reference). Therefore, we can convert this thin pointer into a ` usize ` , which
84- is suitable for passing across an FFI boundary.
81+ reference * to this mutable reference* (` &mut &mut dyn PanicPayload ` ), and convert it to a raw
82+ pointer (` *mut &mut dyn PanicPayload ` ). The outer raw pointer is a thin pointer, since it points to
83+ a ` Sized ` type (a mutable reference). Therefore, we can convert this thin pointer into a ` usize ` ,
84+ which is suitable for passing across an FFI boundary.
8585
8686Finally, we call ` __rust_start_panic ` with this ` usize ` . We have now entered the panic runtime.
8787
@@ -96,8 +96,8 @@ as you would expect.
9696` panic_unwind ` is the more interesting case.
9797
9898In its implementation of ` __rust_start_panic ` , we take the ` usize ` , convert
99- it back to a ` *mut &mut dyn BoxMeUp ` , dereference it, and call ` box_me_up `
100- on the ` &mut dyn BoxMeUp ` . At this point, we have a raw pointer to the payload
99+ it back to a ` *mut &mut dyn PanicPayload ` , dereference it, and call ` take_box `
100+ on the ` &mut dyn PanicPayload ` . At this point, we have a raw pointer to the payload
101101itself (a ` *mut (dyn Send + Any) ` ): that is, a raw pointer to the actual value
102102provided by the user who called ` panic! ` .
103103
0 commit comments