-
Notifications
You must be signed in to change notification settings - Fork 599
add extern "custom"
#2300
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
base: master
Are you sure you want to change the base?
add extern "custom"
#2300
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
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. Somewhere in the reference it would probably be good to clarify the purpose of parameters and return types in
Contributor
Author
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. We actually disallow them entirely |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,6 +239,21 @@ With `panic=unwind`, when a `panic` is turned into an abort by a non-unwinding A | |
|
|
||
| For other considerations and limitations regarding unwinding across FFI boundaries, see the [relevant section in the Panic documentation][panic-ffi]. | ||
|
|
||
| r[items.fn.extern.custom] | ||
| An `extern "custom"` function has an unknown, custom ABI. The only way to call such a function is via [inline assembly]. | ||
|
Contributor
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. Maybe a usage hint:
|
||
|
|
||
| r[items.fn.extern.custom.safety] | ||
| An `extern "custom"` function must be `unsafe`. | ||
|
|
||
| r[items.fn.extern.custom.parameters] | ||
| An `extern "custom"` function does not have any parameters. | ||
|
|
||
| r[items.fn.extern.custom.return-type] | ||
| An `extern "custom"` function must return the [unit type]. | ||
|
|
||
| r[items.fn.extern.custom.naked] | ||
| An `extern "custom"` function definition must be a [naked function]. | ||
|
|
||
|
Comment on lines
+242
to
+256
Contributor
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. We need to add the rules here about what's allowed or not allowed in terms of parameters and return types.
Contributor
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. @rustbot author
Contributor
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. And we need to add text about the function pointer restrictions as well.
Contributor
Author
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. where should that function pointer text go? Here on the item and/or in |
||
| [forced-unwinding]: https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html#forced-unwinding | ||
| [panic handler]: ../panic.md#the-panic_handler-attribute | ||
| [panic-ffi]: ../panic.md#unwinding-across-ffi-boundaries | ||
|
|
@@ -411,6 +426,7 @@ fn foo_oof(#[some_inert_attribute] arg: u8) { | |
| [testing attributes]: ../attributes/testing.md | ||
| [`cold`]: ../attributes/codegen.md#the-cold-attribute | ||
| [`inline`]: ../attributes/codegen.md#the-inline-attribute | ||
| [naked function]: ../attributes/codegen.md#the-naked-attribute | ||
| [`deprecated`]: ../attributes/diagnostics.md#the-deprecated-attribute | ||
| [`doc`]: ../../rustdoc/the-doc-attribute.html | ||
| [`must_use`]: ../attributes/diagnostics.md#the-must_use-attribute | ||
|
|
@@ -427,3 +443,4 @@ fn foo_oof(#[some_inert_attribute] arg: u8) { | |
| [variadic function]: external-blocks.md#variadic-functions | ||
| [`extern` block]: external-blocks.md | ||
| [zero-sized]: glossary.zst | ||
| [inline assembly]: ../inline-assembly.md | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be good to have an example at
src/inline-assembly.mdalongside naked functions?View changes since the review