Skip to content

Commit b0ec725

Browse files
JohnTitorGankra
authored andcommitted
Fix some style issues
1 parent c162bb7 commit b0ec725

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/coercions.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# Coercions
22

3-
Types can implicitly be coerced to change in certain contexts. These changes are
4-
generally just *weakening* of types, largely focused around pointers and
5-
lifetimes. They mostly exist to make Rust "just work" in more cases, and are
6-
largely harmless.
3+
Types can implicitly be coerced to change in certain contexts.
4+
These changes are generally just *weakening* of types, largely focused around pointers and lifetimes.
5+
They mostly exist to make Rust "just work" in more cases, and are largely harmless.
76

87
For an exhaustive list of all the types of coercions, see the [Coercion types] section on the reference.
98

109
## Cases where coercions do not perform
1110

12-
Note that we do not perform coercions when matching traits (except for
13-
receivers, see below). If there is an impl for some type `U` and `T` coerces to
14-
`U`, that does not constitute an implementation for `T`. For example, the
15-
following will not type check, even though it is OK to coerce `t` to `&T` and
16-
there is an impl for `&T`:
11+
Note that we do not perform coercions when matching traits (except for receivers, see below).
12+
If there is an `impl` for some type `U` and `T` coerces to `U`, that does not constitute an implementation for `T`.
13+
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`:
1714

1815
```rust,compile_fail
1916
trait Trait {}
@@ -28,6 +25,8 @@ fn main() {
2825
}
2926
```
3027

28+
which fails like the following:
29+
3130
```text
3231
error[E0277]: the trait bound `&mut i32: Trait` is not satisfied
3332
--> src/main.rs:9:9

0 commit comments

Comments
 (0)