why the i32 reference can add with i32
That works because there is an implementation of the Add
trait between a i32
and &i32
. The implementation is exactly as you would expect - first we dereference the &i32
to get a i32
, then we add the two i32
s together like normal.
1 Like