Skip to content

Commit 70c99cb

Browse files
authored
Merge pull request #1954 from paldepind/coercion-site-assignment
Document assignment expression as coercion site
2 parents 842326a + 4382968 commit 70c99cb

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/type-coercions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ r[coerce.site.return]
6969
}
7070
```
7171

72+
r[coerce.site.assignment]
73+
* Assigned value operands in assignment expressions
74+
75+
For example, `y` is coerced to have type `&i8` in the following:
76+
```rust
77+
let mut x = &0i8;
78+
let y = &mut 42i8;
79+
x = y;
80+
```
81+
7282
r[coerce.site.subexpr]
7383
If the expression in one of these coercion sites is a coercion-propagating expression, then the relevant sub-expressions in that expression are also coercion sites. Propagation recurses from these new coercion sites. Propagating expressions and their relevant sub-expressions are:
7484

0 commit comments

Comments
 (0)