Skip to content

Commit c0e3f05

Browse files
committed
reflow
1 parent cd47965 commit c0e3f05

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

src/doc/rustc-dev-guide/src/panic-implementation.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ Let's break this type down:
7979

8080
1. `PanicPayload` is an internal trait.
8181
It is implemented for `PanicPayload`
82-
(a wrapper around the user-supplied payload type), and has a method
83-
`fn take_box(&mut self) -> *mut (dyn Any + Send)`.
84-
This method takes the user-provided payload (`T: Any + Send`),
85-
boxes it, and converts the box to a raw pointer.
82+
(a wrapper around the user-supplied payload type), and has a method
83+
`fn take_box(&mut self) -> *mut (dyn Any + Send)`.
84+
This method takes the user-provided payload (`T: Any + Send`),
85+
boxes it, and converts the box to a raw pointer.
8686

8787
2. When we call `__rust_start_panic`, we have an `&mut dyn PanicPayload`.
88-
However, this is a fat pointer (twice the size of a `usize`).
89-
To pass this to the panic runtime across an FFI boundary, we take a mutable
90-
reference *to this mutable reference* (`&mut &mut dyn PanicPayload`), and convert it to a raw
91-
pointer (`*mut &mut dyn PanicPayload`).
92-
The outer raw pointer is a thin pointer, since it points to a `Sized` type (a mutable reference).
93-
Therefore, we can convert this thin pointer into a `usize`,
94-
which is suitable for passing across an FFI boundary.
88+
However, this is a fat pointer (twice the size of a `usize`).
89+
To pass this to the panic runtime across an FFI boundary, we take a mutable
90+
reference *to this mutable reference* (`&mut &mut dyn PanicPayload`), and convert it to a raw
91+
pointer (`*mut &mut dyn PanicPayload`).
92+
The outer raw pointer is a thin pointer, since it points to a `Sized` type (a mutable reference).
93+
Therefore, we can convert this thin pointer into a `usize`,
94+
which is suitable for passing across an FFI boundary.
9595

9696
Finally, we call `__rust_start_panic` with this `usize`.
9797
We have now entered the panic runtime.
@@ -123,7 +123,6 @@ Note that all panics either abort the process or get caught by some call to `cat
123123
In particular, in std's [runtime service],
124124
the call to the user-provided `main` function is wrapped in `catch_unwind`.
125125

126-
127126
[runtime service]: https://github.com/rust-lang/rust/blob/HEAD/library/std/src/rt.rs
128127
[`library/core/src/panicking.rs`]: https://doc.rust-lang.org/core/panicking/index.html
129128
[`compiler/rustc_hir/src/weak_lang_items.rs`]: https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_hir/src/weak_lang_items.rs

0 commit comments

Comments
 (0)