Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/types/function-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@ let foo_ptr_2 = if want_i32 {
```

r[type.fn-item.traits]
All function items implement [`Copy`], [`Clone`], [`Send`], and [`Sync`].
All function items implement [`Copy`], [`Clone`], and all the [auto traits][lang-types.auto-traits].

[`Fn`], [`FnMut`], and [`FnOnce`] are implemented unless the function has any of the following:

- an [`unsafe`][unsafe.fn] qualifier
- a [`target_feature` attribute][attributes.codegen.target_feature]
- an [ABI][items.fn.extern] other than `"Rust"`
- an [ABI][items.fn.extern] of `"custom"`
- a [C-variadic][items.fn.c-variadic] rest parameter

[`Clone`]: ../special-types-and-traits.md#clone
[`Copy`]: ../special-types-and-traits.md#copy
[`Send`]: ../special-types-and-traits.md#send
[`Sync`]: ../special-types-and-traits.md#sync
[coercion]: ../type-coercions.md
[function pointers]: function-pointer.md
[zero-sized]: glossary.zst
3 changes: 3 additions & 0 deletions src/types/function-pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ For the function to be variadic, its `extern` ABI must be one of those listed in
r[type.fn-pointer.extern-custom]
An `extern "custom"` function pointer must follow the rules in [items.fn.extern.custom.signature].

r[type.fn-pointer.traits]
A function pointer implements [the same traits][type.fn-item.traits] as a function item with the same signature.

r[type.fn-pointer.attributes]
## Attributes on function pointer parameters

Expand Down
Loading