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
In the Identifier Patterns section it is mentioned that path patterns take precedence over identifier patterns.
I thought adding the following example would be helpful to demonstrate this:
fnmain(){constNUMBER:i32 = 10;let a = 12;match a
{NUMBER => {assert_eq!(NUMBER, 10)},//NUMBER here is 10, it does NOT shadow a
_ => ()//this catch-all is needed or we would get a non-exhaustive patterns error}}
I was also wondering if this type of example is the only type there is:
Are there any other types of examples where you would see this precedence taking place?
The text was updated successfully, but these errors were encountered:
In the Identifier Patterns section it is mentioned that path patterns take precedence over identifier patterns.
I thought adding the following example would be helpful to demonstrate this:
I was also wondering if this type of example is the only type there is:
Are there any other types of examples where you would see this precedence taking place?
The text was updated successfully, but these errors were encountered: