From 596c5771f60427b6381b6c5b01851ae725a28d9d Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 12 Mar 2025 22:11:16 -0400 Subject: [PATCH 1/2] Modify mutable deref rule for `&mut T` --- src/expressions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions.md b/src/expressions.md index 8827c9592..e63e02264 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -241,7 +241,7 @@ The following expressions can be mutable place expression contexts: * [Temporary values]. * [Fields][field]: this evaluates the subexpression in a mutable place expression context. * [Dereferences][deref] of a `*mut T` pointer. -* Dereference of a variable, or field of a variable, with type `&mut T`. +* Dereference of a movable place, with type `&mut T`. This includes variables and their fields, as well as temporaries. Note: This is an exception to the requirement of the next rule. * Dereferences of a type that implements `DerefMut`: this then requires that the value being dereferenced is evaluated in a mutable place expression context. From c732fa0a963ef4140a57aba082ca6296f8651e01 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Thu, 20 Mar 2025 17:23:17 +0000 Subject: [PATCH 2/2] Apply suggestions from PR --- src/expressions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions.md b/src/expressions.md index e63e02264..96c9a4a23 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -241,7 +241,7 @@ The following expressions can be mutable place expression contexts: * [Temporary values]. * [Fields][field]: this evaluates the subexpression in a mutable place expression context. * [Dereferences][deref] of a `*mut T` pointer. -* Dereference of a movable place, with type `&mut T`. This includes variables and their fields, as well as temporaries. +* Dereference of a [movable place][expr.move.movable-place] with type `&mut T`. This includes variables and their fields, as well as temporaries. Note: This is an exception to the requirement of the next rule. * Dereferences of a type that implements `DerefMut`: this then requires that the value being dereferenced is evaluated in a mutable place expression context.