From 393e54b74919b2ca7233e180b3e98aceba4a1d17 Mon Sep 17 00:00:00 2001 From: mexus Date: Sun, 27 Sep 2020 16:39:05 +0300 Subject: [PATCH 1/2] coercions.md: non-capturing closures to function pointers --- src/coercions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coercions.md b/src/coercions.md index 5a597b4..d6547fe 100644 --- a/src/coercions.md +++ b/src/coercions.md @@ -18,6 +18,7 @@ Coercion is allowed between the following types: * `&mut T` to `*mut T` * Unsizing: `T` to `U` if `T` implements `CoerceUnsized` * Deref coercion: Expression `&x` of type `&T` to `&*x` of type `&U` if `T` derefs to `U` (i.e. `T: Deref`) +* Non-capturing closure to a function pointer ([RFC 1558](https://rust-lang.github.io/rfcs/1558-closure-to-fn-coercion.html)), e.g. `|| 8usize` to `fn() -> usize` `CoerceUnsized> for Pointer where T: Unsize` is implemented for all pointer types (including smart pointers like Box and Rc). Unsize is From cb88439ac9d11e60412ac86ab0c47ba88649c9c6 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 5 Nov 2020 13:26:39 +0900 Subject: [PATCH 2/2] Update src/coercions.md --- src/coercions.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coercions.md b/src/coercions.md index d6547fe..065a9e1 100644 --- a/src/coercions.md +++ b/src/coercions.md @@ -18,7 +18,9 @@ Coercion is allowed between the following types: * `&mut T` to `*mut T` * Unsizing: `T` to `U` if `T` implements `CoerceUnsized` * Deref coercion: Expression `&x` of type `&T` to `&*x` of type `&U` if `T` derefs to `U` (i.e. `T: Deref`) -* Non-capturing closure to a function pointer ([RFC 1558](https://rust-lang.github.io/rfcs/1558-closure-to-fn-coercion.html)), e.g. `|| 8usize` to `fn() -> usize` +* 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> for Pointer where T: Unsize` is implemented for all pointer types (including smart pointers like Box and Rc). Unsize is