Skip to content

Commit c83d315

Browse files
committed
Add rules on extern "custom" fn() signatures
On the lang side, we decided the signature rules for `extern "custom"` function pointers should match those for `extern "custom"` function items. Let's consolidate the signature rules on function items into a single rule then cite that rule normatively from the function pointer types chapter.
1 parent dd7a121 commit c83d315

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/items/functions.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,12 @@ For other considerations and limitations regarding unwinding across FFI boundari
244244
r[items.fn.extern.custom.intro]
245245
An `extern "custom"` function has an unknown, custom ABI. The only way to call such a function is via [inline assembly].
246246

247-
r[items.fn.extern.custom.safety]
248-
An `extern "custom"` function must be `unsafe`.
247+
r[items.fn.extern.custom.signature]
248+
The signature of an `extern "custom"` function must:
249249

250-
r[items.fn.extern.custom.parameters]
251-
An `extern "custom"` function must not have any parameters.
252-
253-
r[items.fn.extern.custom.return-type]
254-
An `extern "custom"` function must return the [unit type].
250+
- Be `unsafe`.
251+
- Not have any parameters.
252+
- Return the [unit type].
255253

256254
r[items.fn.extern.custom.naked]
257255
An `extern "custom"` function definition must be a [naked function].

src/types/function-pointer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ The `unsafe` qualifier indicates that the type's value is an [unsafe function],
5050
r[type.fn-pointer.constraint-variadic]
5151
For the function to be variadic, its `extern` ABI must be one of those listed in [items.extern.variadic.conventions].
5252

53+
r[type.fn-pointer.extern-custom]
54+
The signature of an `extern "custom"` function pointer must follow the rules in [items.fn.extern.custom.signature].
55+
5356
r[type.fn-pointer.attributes]
5457
## Attributes on function pointer parameters
5558

0 commit comments

Comments
 (0)