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
structS(u32);fnfoo(x:&S){let _:&u32 = match x {S(y) => y,
_ => &0,};}
Here, the variable binding y has type &u32 outside the pattern. However, inside the pattern it has type u32. The fact that these types do not align is confusing, as it means you can't dereference y inside the pattern like this:
fnfoo(x:&S){let _:u32 = match x {S(&y) => y,
_ => 0,};}
and instead have to dereference it outside the pattern:
fnfoo(x:&S){let _:u32 = match x {S(y) => *y,
_ => 0,};}
Is there any reason this was chosen to be the case, or is required to be the case? As it stands, this behaviour is very counter-intuitive.
mark-i-m, CryZe, bluss, Boscop, sollyucko and 7 moremark-i-m, CryZe, RalfJung, Boscop, jplatte and 2 more