You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I feel like this is intentional behavior. Pattern matching on a Box requires the use of box patterns; that is, let &box A { x: x1, y: y1 } = boxed_a; is the intended way to make this work. Alternatively, you could do let &A { x: x1, y: y1 } = &**boxed_a;, which while ugly, does work on stable.
As such I'm going to close this issue; we simply don't deref in patterns (intentionally, as far as I know) though this could change with the recent match reform RFC.
Auto-dereferencing is working if
&Box<Struct>
is in place of&Struct
function argument, or in:but not if Struct reference is destructured:
Example:
Is it a bug or intended behaviour?
The text was updated successfully, but these errors were encountered: