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
fn main() {
match (1, 2, 3) {
(1, a, b) | (2, b, a) => {
printfln!(a);
printfln!(b);
},
_ => fail!(),
}
}
This code unexpectedly outputs:
3
3
The problem (as I understand it), is in variable binding. We bind variables for both patterns in the same arm, and different pattern overwrite each other.
Pointers to bound variables shouldn't be stored before checking pattern,
otherwise piped patterns can conflict with each other (issue #6338).
Closes#6338.
The following code compiles:
But when it runs if fails like so (on 64 bit linux):
Note that it prints "b" before segfaulting, but that is actually incorrect - the first println should print "a".
The text was updated successfully, but these errors were encountered: