Skip to content

Commit 9e073fc

Browse files
Kyle StrandBatmanAoD
authored andcommitted
cross reference with 'destructors'
1 parent 815cff6 commit 9e073fc

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/destructors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ Temporaries are also created to hold the result of operands to an expression
219219
while the other operands are evaluated. The temporaries are associated to the
220220
scope of the expression with that operand. Since the temporaries are moved from
221221
once the expression is evaluated, dropping them has no effect unless one of the
222-
operands to an expression breaks out of the expression, returns, or panics.
223-
224-
<!-- XXX note about panic=abort here? -->
222+
operands to an expression breaks out of the expression, returns, or
223+
[panics][panic].
225224

226225
```rust
227226
# struct PrintOnDrop(&'static str);
@@ -364,6 +363,7 @@ variable or field from being dropped automatically.
364363
[initialized]: glossary.md#initialized
365364
[interior mutability]: interior-mutability.md
366365
[lazy boolean expression]: expressions/operator-expr.md#lazy-boolean-operators
366+
[panic]: panic.md
367367
[place context]: expressions.md#place-expressions-and-value-expressions
368368
[promoted]: destructors.md#constant-promotion
369369
[scrutinee]: glossary.md#scrutinee

src/panic.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,23 @@ Although it is not part of the core language, panics interact with several core
1010
language features; for instance, out-of-bounds array indexing using the
1111
`array[index]` syntax will automatically panic.
1212

13-
[macro-panic]: ../std/macro.panic.html
14-
[fn-catch-unwind]: ../std/panic/fn.catch_unwind.html
15-
[join]: ../std/thread/struct.JoinHandle.html#method.join
16-
1713
## Unwinding
1814

1915
Panicking may either be recoverable or non-recoverable, though its behavior
2016
must be homogenous throughout program execution. A recoverable panic "unwinds"
2117
Rust frames, just as C++'s `throw` unwinds C++ frames. This means that as the
22-
panic traverses Rust frames, live objects in those frames that implement `Drop`
23-
will have their `drop` methods called. Thus, if panic recovery does occur (for
24-
instance at a thread boundary), the objects will have been "cleaned up" just as
25-
if the stack frames had returned normally.
18+
panic traverses Rust frames, live objects in those frames that [implement
19+
`Drop`][destructors] will have their `drop` methods called. Thus, if panic
20+
recovery does occur (for instance at a thread boundary), the objects will have
21+
been "cleaned up" just as if they had gone out of scope normally.
2622

2723
> As long as this guarantee of resource-cleanup is preserved, "unwinding" may
2824
> be implemented without actually using the mechanism used by C++ for the
2925
> target platform.
3026
3127
> The Standard Library provides two mechanisms for recovering from a panic,
3228
> [`catch_unwind`][fn-catch-unwind] (which enables recovery within the
33-
> panicking thread) and [`JoinHandle::join`][join] (which enables a process to
29+
> panicking thread) and [`JoinHandle::join`][thread-join] (which enables a process to
3430
> continue execution without recovering the panicked thread).
3531
3632
## Panic runtimes
@@ -46,3 +42,8 @@ runtime_.
4642
When compiling code that is guaranteed (via a [compiler option][rustc-codegen])
4743
not to unwind, the optimizer may assume that unwinding across Rust frames is
4844
impossible, which can result in both code-size and runtime speed improvements.
45+
46+
[destructors]: destructors.md
47+
[fn-catch-unwind]: ../std/panic/fn.catch_unwind.html
48+
[macro-panic]: ../std/macro.panic.html
49+
[thread-join]: ../std/thread/struct.JoinHandle.html#method.join

0 commit comments

Comments
 (0)