diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2019-12-02 13:19:19 -0500 |
|---|---|---|
| committer | Who? Me?! <mark-i-m@users.noreply.github.com> | 2020-01-02 21:54:14 -0600 |
| commit | b73fee53d34af6c5c8448831991f1737531e9752 (patch) | |
| tree | f4564c16e7c0e36078e11838e92c853e5c366cc4 /src/doc/rustc-dev-guide | |
| parent | 5708a70893c7cd237b48bff0a1980c813c08332b (diff) | |
| download | rust-b73fee53d34af6c5c8448831991f1737531e9752.tar.gz rust-b73fee53d34af6c5c8448831991f1737531e9752.zip | |
Fix line lengths
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/panic-implementation.md | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/doc/rustc-dev-guide/src/panic-implementation.md b/src/doc/rustc-dev-guide/src/panic-implementation.md index 4f4fb1a9891..b62e2643672 100644 --- a/src/doc/rustc-dev-guide/src/panic-implementation.md +++ b/src/doc/rustc-dev-guide/src/panic-implementation.md @@ -4,7 +4,8 @@ There are actually two panic macros - one defined in `libcore`, and one defined in `libstd`. This is due to the fact that code in `libcore` can panic. `libcore` is built before `libstd`, -but we want panics to use the same machinery at runtime, whether they originate in `libcore` or `libstd`. +but we want panics to use the same machinery at runtime, whether they originate in `libcore` +or `libstd`. ##### libcore definition of panic! @@ -65,12 +66,14 @@ we call ```__rust_start_panic```, which is provided by the panic runtime. The call to ```__rust_start_panic``` is very weird - it is passed a ```*mut &mut dyn BoxMeUp```, converted to an `usize`. Let's break this type down: -1. `BoxMeUp` is an internal trait. It is implemented for `PanicPayload` (a wrapper around the user-supplied -payload type), and has a method ```fn box_me_up(&mut self) -> *mut (dyn Any + Send)```. +1. `BoxMeUp` is an internal trait. It is implemented for `PanicPayload` +(a wrapper around the user-supplied payload type), and has a method +```fn box_me_up(&mut self) -> *mut (dyn Any + Send)```. This method takes the user-provided payload (`T: Any + Send`), boxes it, and convertes the box to a raw pointer. -2. When we call ```__rust_start_panic```, we have an `&mut dyn BoxMeUp`. However, this is a fat pointer -(twice the size of a `usize`). To pass this to the panic runtime across an FFI boundary, we take a mutable +2. When we call ```__rust_start_panic```, we have an `&mut dyn BoxMeUp`. +However, this is a fat pointer (twice the size of a `usize`). +To pass this to the panic runtime across an FFI boundary, we take a mutable reference *to this mutable reference* (`&mut &mut dyn BoxMeUp`), and convert it to a raw pointer (`*mut &mut dyn BoxMeUp`). The outer raw pointer is a thin pointer, since it points to a `Sized` type (a mutable reference). Therefore, we can convert this thin pointer into a `usize`, which |
