Skip to content

Commit f620c53

Browse files
committed
Fix line lengths
1 parent 58a76a3 commit f620c53

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/panic-implementation.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
There are actually two panic macros - one defined in `libcore`, and one defined in `libstd`.
66
This is due to the fact that code in `libcore` can panic. `libcore` is built before `libstd`,
7-
but we want panics to use the same machinery at runtime, whether they originate in `libcore` or `libstd`.
7+
but we want panics to use the same machinery at runtime, whether they originate in `libcore`
8+
or `libstd`.
89

910
##### libcore definition of panic!
1011

@@ -65,12 +66,14 @@ we call ```__rust_start_panic```, which is provided by the panic runtime.
6566
The call to ```__rust_start_panic``` is very weird - it is passed a ```*mut &mut dyn BoxMeUp```,
6667
converted to an `usize`. Let's break this type down:
6768

68-
1. `BoxMeUp` is an internal trait. It is implemented for `PanicPayload` (a wrapper around the user-supplied
69-
payload type), and has a method ```fn box_me_up(&mut self) -> *mut (dyn Any + Send)```.
69+
1. `BoxMeUp` is an internal trait. It is implemented for `PanicPayload`
70+
(a wrapper around the user-supplied payload type), and has a method
71+
```fn box_me_up(&mut self) -> *mut (dyn Any + Send)```.
7072
This method takes the user-provided payload (`T: Any + Send`), boxes it, and convertes the box to a raw pointer.
7173

72-
2. When we call ```__rust_start_panic```, we have an `&mut dyn BoxMeUp`. However, this is a fat pointer
73-
(twice the size of a `usize`). To pass this to the panic runtime across an FFI boundary, we take a mutable
74+
2. When we call ```__rust_start_panic```, we have an `&mut dyn BoxMeUp`.
75+
However, this is a fat pointer (twice the size of a `usize`).
76+
To pass this to the panic runtime across an FFI boundary, we take a mutable
7477
reference *to this mutable reference* (`&mut &mut dyn BoxMeUp`), and convert it to a raw pointer
7578
(`*mut &mut dyn BoxMeUp`). The outer raw pointer is a thin pointer, since it points to a `Sized`
7679
type (a mutable reference). Therefore, we can convert this thin pointer into a `usize`, which

0 commit comments

Comments
 (0)