From c61953a5b2c5774354cf41dd7cdcd93180e91881 Mon Sep 17 00:00:00 2001 From: Michal 'vorner' Vaner Date: Sat, 29 Dec 2018 08:31:26 +0100 Subject: [PATCH] Trivial updates to the coercions chapter * The modern way is `dyn Trait * Use `compile_fail` instead of ignore, to make sure it doesn't start compiling by accident in some future version of Rust (and also to provide link to playground). --- src/coercions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coercions.md b/src/coercions.md index 509f7768..5a597b47 100644 --- a/src/coercions.md +++ b/src/coercions.md @@ -24,7 +24,7 @@ for all pointer types (including smart pointers like Box and Rc). Unsize is only implemented automatically, and enables the following transformations: * `[T; n]` => `[T]` -* `T` => `Trait` where `T: Trait` +* `T` => `dyn Trait` where `T: Trait` * `Foo<..., T, ...>` => `Foo<..., U, ...>` where: * `T: Unsize` * `Foo` is a struct @@ -51,7 +51,7 @@ receivers, see below). If there is an impl for some type `U` and `T` coerces to following will not type check, even though it is OK to coerce `t` to `&T` and there is an impl for `&T`: -```rust,ignore +```rust,compile_fail trait Trait {} fn foo(t: X) {}