Summary

Remove the coercion from Box<T> to &mut T from the language.

言語

Motivation

Currently, the coercion between Box<T> to &mut T can be a hazard because it can lead to surprising mutation where it was not expected.

Detailed design
設計(する)

The coercion between Box<T> and &mut T should be removed.

Note that methods that take

とる
&mut self can still be called
呼び出し
on values of type Box<T> without any special referencing or dereferencing. That is because the semantics of auto-deref and auto-ref conspire to make it work: the types unify after one autoderef followed
下記の、次に続く、追従する
by one autoref.

Drawbacks

Borrowing from Box<T> to &mut T may be convenient.

Alternatives

An alternative

代わりのもの、選択肢
is to remove &T coercions as well, but this was decided against as they are convenient.

The impact of not doing this is that the coercion will remain.

Unresolved questions

None.