为什么这个右值没有提升为参考中指定的左值?

Why isn't this rvalue promoted to an lvalue as specified in the reference?

Rust Reference 说:

The left operand of an assignment or compound-assignment expression is an lvalue context, as is the single operand of a unary borrow.

[...]

When an rvalue is used in an lvalue context, a temporary un-named lvalue is created and used instead.

这个右值提升显然适用于借用:

let ref_to_i32 = &27;  // a temporary i32 variable with value 27 is created

但它似乎在赋值中不起作用(尽管参考文献谈到 所有 左值上下文,而不仅仅是借用):

27 = 28;   // error[E0070]: invalid left-hand side expression

error description of E0070 没有提到这个右值提升。这是引用中的错误还是确实有某种方法可以通过赋值或复合赋值表达式触发右值提升?

还有第三种左值上下文,参考文献也对其描述不正确。每当其中有一个带有 ref 的模式时,绑定到该模式的左值就是一个左值上下文。事实证明,促销在​​这种情况下有效:

let ref x = 3;  // works

很明显,仅晋升不适用于(复合)作业?

The reference 自发布此问题后已更新。现在它说右值到左值的提升不会在赋值期间发生,所以这显然是旧参考中的一个错误。

Borrow operators:

If the & or &mut operators are applied to an rvalue, a temporary value is created

这可能也适用于 ref 绑定,尽管我没有看到它被明确提及。

Assignment:

The left-hand operand must be an lvalue: using an rvalue results in a compiler error, rather than promoting it to a temporary.