Skip to content

Commit

Permalink
Merge pull request #238 from mexus/master
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor authored Nov 5, 2020
2 parents ea054bb + cb88439 commit 23c49f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/coercions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Coercion is allowed between the following types:
* `&mut T` to `*mut T`
* Unsizing: `T` to `U` if `T` implements `CoerceUnsized<U>`
* Deref coercion: Expression `&x` of type `&T` to `&*x` of type `&U` if `T` derefs to `U` (i.e. `T: Deref<Target=U>`)
* Non-capturing closure to a function pointer ([RFC 1558], e.g. `|| 8usize` to `fn() -> usize`)

[RFC 1558]: https://rust-lang.github.io/rfcs/1558-closure-to-fn-coercion.html

`CoerceUnsized<Pointer<U>> for Pointer<T> where T: Unsize<U>` is implemented
for all pointer types (including smart pointers like Box and Rc). Unsize is
Expand Down

0 comments on commit 23c49f1

Please sign in to comment.