You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/expressions/operator-expr.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,10 +164,13 @@ r[expr.deref.intro]
164
164
The `*` (dereference) operator is also a unary prefix operator.
165
165
166
166
r[expr.deref.result]
167
-
When applied to a [pointer](../types/pointer.md) it denotes the pointed-to location.
167
+
When applied to a [pointer](../types/pointer.md)or [`Box`], it denotes the pointed-to location.
168
168
169
169
r[expr.deref.mut]
170
-
If the expression is of type `&mut T` or `*mut T`, and is either a local variable, a (nested) field of a local variable or is a mutable [place expression], then the resulting memory location can be assigned to.
170
+
If the expression is of type `&mut T`, `*mut T`, or `Box<T>`, and is either a local variable, a (nested) field of a local variable or is a mutable [place expression], then the resulting memory location can be assigned to.
171
+
172
+
r[expr.deref.box]
173
+
When applied to a [`Box`], the resultant place may be [moved from].
171
174
172
175
r[expr.deref.safety]
173
176
Dereferencing a raw pointer requires `unsafe`.
@@ -176,11 +179,14 @@ r[expr.deref.traits]
176
179
On non-pointer types `*x` is equivalent to `*std::ops::Deref::deref(&x)` in an [immutable place expression context](../expressions.md#mutability) and `*std::ops::DerefMut::deref_mut(&mut x)` in a mutable place expression context.
177
180
178
181
```rust
182
+
# structNoCopy;
179
183
letx=&7;
180
184
assert_eq!(*x, 7);
181
185
lety=&mut9;
182
186
*y=11;
183
187
assert_eq!(*y, 11);
188
+
letz=Box::new(NoCopy);
189
+
let_:NoCopy=*z;
184
190
```
185
191
186
192
r[expr.try]
@@ -1208,6 +1214,7 @@ As with normal assignment expressions, compound assignment expressions always pr
0 commit comments