-
Notifications
You must be signed in to change notification settings - Fork 533
panic runtime and C-unwind documentation #1226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 40 commits
5f63e46
c8fc0e8
edd5b18
39de76c
6413901
70f8292
d08e406
a20802e
2525ab4
5bff1e3
7453efd
c3cc7fa
860691e
543bc27
4bb0248
386b2f3
c7a7961
20af0b1
da53531
8fd8208
0f3c015
63677c1
caa17fc
0b37538
eafe95d
5f21a1a
79cc53f
c38044d
20bd38f
f309b2f
2617cd5
d49c90c
6eaa1fa
a740002
f7cb25e
34e0b68
8f4dc2b
6e76b5c
7049886
003a8a4
cdd00de
ffc056c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,9 @@ r[undefined.target-feature] | |
does not support (see [`target_feature`]), *except* if the platform explicitly documents this to be safe. | ||
|
||
r[undefined.call] | ||
* Calling a function with the wrong call ABI or unwinding from a function with the wrong unwind ABI. | ||
* Calling a function with the wrong [call ABI][abi], or unwinding past a stack | ||
frame that does not allow unwinding (e.g. by calling a `"C-unwind"` function | ||
imported or transmuted as a `"C"` function or function pointer). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there something this can link to that explicitly says what frames don't allow unwinding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I recall correctly, the intent here was to leave open the possibility of other future mechanisms prohibiting unwinding. It may also be that there's something else I'm not thinking of at the moment that can make unwinding past a frame illegal or undefined. But I believe that currently this example, i.e. a call that uses a non-unwinding ABI, is the only form of frame that doesn't allow unwinding. It would, at least, be appropriate to link to the |
||
|
||
r[undefined.invalid] | ||
* Producing an [invalid value][invalid-values]. "Producing" a | ||
|
@@ -96,6 +98,15 @@ r[undefined.const-transmute-ptr2int] | |
'Reinterpreting' refers to loading the pointer value at integer type without a | ||
cast, e.g. by doing raw pointer casts or using a union. | ||
|
||
r[undefined.runtime] | ||
* Violating assumptions of the Rust runtime. Most assumptions of the Rust | ||
runtime are currently not explicitly documented. | ||
* For assumptions specifically related to unwinding, see the [panic | ||
documentation][unwinding-ffi]. | ||
* The runtime assumes that a Rust stack frame is not deallocated without | ||
executing destructors for local variables owned by the stack frame. This assumption | ||
can be violated by C functions like `longjmp`. | ||
|
||
> **Note**: Undefined behavior affects the entire program. For example, calling | ||
> a function in C that exhibits undefined behavior of C means your entire | ||
> program contains undefined behaviour that can also affect the Rust code. And | ||
|
@@ -245,6 +256,7 @@ reading uninitialized memory is permitted are inside `union`s and in "padding" | |
[`const`]: items/constant-items.md | ||
[noalias]: http://llvm.org/docs/LangRef.html#noalias | ||
[pointer aliasing rules]: http://llvm.org/docs/LangRef.html#pointer-aliasing-rules | ||
[abi]: items/external-blocks.md#abi | ||
[undef]: http://llvm.org/docs/LangRef.html#undefined-values | ||
[`target_feature`]: attributes/codegen.md#the-target_feature-attribute | ||
[`UnsafeCell<U>`]: std::cell::UnsafeCell | ||
|
@@ -258,5 +270,6 @@ reading uninitialized memory is permitted are inside `union`s and in "padding" | |
[project-field]: expressions/field-expr.md | ||
[project-tuple]: expressions/tuple-expr.md#tuple-indexing-expressions | ||
[project-slice]: expressions/array-expr.md#array-and-slice-indexing-expressions | ||
[unwinding-ffi]: panic.md#unwinding-across-ffi-boundaries | ||
[const-promoted]: destructors.md#constant-promotion | ||
[lifetime-extended]: destructors.md#temporary-lifetime-extension |
Uh oh!
There was an error while loading. Please reload this page.