From b0ec7251db510258a3e63e623ba44aa8019e7e8c Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 6 Jul 2021 10:26:23 +0900 Subject: [PATCH] Fix some style issues --- src/coercions.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/coercions.md b/src/coercions.md index 252f183..740de40 100644 --- a/src/coercions.md +++ b/src/coercions.md @@ -1,19 +1,16 @@ # Coercions -Types can implicitly be coerced to change in certain contexts. These changes are -generally just *weakening* of types, largely focused around pointers and -lifetimes. They mostly exist to make Rust "just work" in more cases, and are -largely harmless. +Types can implicitly be coerced to change in certain contexts. +These changes are generally just *weakening* of types, largely focused around pointers and lifetimes. +They mostly exist to make Rust "just work" in more cases, and are largely harmless. For an exhaustive list of all the types of coercions, see the [Coercion types] section on the reference. ## Cases where coercions do not perform -Note that we do not perform coercions when matching traits (except for -receivers, see below). If there is an impl for some type `U` and `T` coerces to -`U`, that does not constitute an implementation for `T`. For example, the -following will not type check, even though it is OK to coerce `t` to `&T` and -there is an impl for `&T`: +Note that we do not perform coercions when matching traits (except for receivers, see below). +If there is an `impl` for some type `U` and `T` coerces to `U`, that does not constitute an implementation for `T`. +For example, the following will not type check, even though it is OK to coerce `t` to `&T` and there is an `impl` for `&T`: ```rust,compile_fail trait Trait {} @@ -28,6 +25,8 @@ fn main() { } ``` +which fails like the following: + ```text error[E0277]: the trait bound `&mut i32: Trait` is not satisfied --> src/main.rs:9:9