Skip to content

Commit

Permalink
Merge pull request #878 from lzutao/fn-items-casting
Browse files Browse the repository at this point in the history
Add casting rules from function items to other types
  • Loading branch information
Havvy committed Aug 17, 2020
2 parents 73ca198 + 29d7e4b commit fba96cc
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit fba96cc

Please sign in to comment.