lang (typesystem | references | coercions)
Remove the coercion from Box<T>
to &T
from the language.
The coercion between Box<T>
to &T
is not replicable by user-defined smart pointers and has been found to be rarely used 1. We already removed the coercion between Box<T>
and &mut T
in RFC 33.
The coercion between Box<T>
and &T
should be removed.
Note that methods that take &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.
Borrowing from Box<T>
to &T
may be convenient.
The impact of not doing this is that the coercion will remain.
None.