Skip to content
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

Add casting rules from function items to other types #878

Merged
merged 1 commit into from
Aug 17, 2020
Merged
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
9 changes: 7 additions & 2 deletions src/expressions/operator-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,11 @@ well as the following additional casts. Here `*T` means either `*const T` or
| `*T` where `T: Sized` | Numeric type | Pointer to address cast |
| Integer type | `*V` where `V: Sized` | Address to pointer cast |
| `&[T; n]` | `*const T` | Array to pointer cast |
| [Function pointer](../types/function-pointer.md) | `*V` where `V: Sized` | Function pointer to pointer cast |
| Function pointer | Integer | Function pointer to address cast |
| [Function item] | [Function pointer] | Function item to function pointer cast |
| [Function item] | `*V` where `V: Sized` | Function item to pointer cast |
| [Function item] | Integer | Function item to address cast |
| [Function pointer] | `*V` where `V: Sized` | Function pointer to pointer cast |
| [Function pointer] | Integer | Function pointer to address cast |
| Closure \*\* | Function pointer | Closure to function pointer cast |

\* or `T` and `V` are compatible unsized types, e.g., both slices, both the
Expand Down Expand Up @@ -458,6 +461,8 @@ assert_eq!(x, 14);
[temporary value]: ../expressions.md#temporaries
[float-float]: https://github.com/rust-lang/rust/issues/15536
[`unit` type]: ../types/tuple.md
[Function pointer]: ../types/function-pointer.md
[Function item]: ../types/function-item.md

[_BorrowExpression_]: #borrow-operators
[_DereferenceExpression_]: #the-dereference-operator
Expand Down