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
fnmain(){enumE{A,B,}let x = E::A;let y = true;match x {E::A | E::Bif !y => println!("if applies only to last pattern"),
_ => println!("if applies to all OR'd patterns"),}}
The behaviour of this code depends on whether the guard applies to only the pattern it succeeds, or to the entire match arm. Running it on nightly behaves as though the guard applies to the entire arm (i.e. the first arm is not matched), but this is not stipulated anywhere in the docs as far as I can tell. If this interpretation of the code is indeed the expected one, then this should be documented.
The text was updated successfully, but these errors were encountered:
Consider the following code:
The behaviour of this code depends on whether the guard applies to only the pattern it succeeds, or to the entire match arm. Running it on nightly behaves as though the guard applies to the entire arm (i.e. the first arm is not matched), but this is not stipulated anywhere in the docs as far as I can tell. If this interpretation of the code is indeed the expected one, then this should be documented.
The text was updated successfully, but these errors were encountered: