1 // This test ensures that or patterns require binding mode consistency across arms.
3 #![feature(or_patterns)]
4 #![allow(non_camel_case_types)]
7 let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
8 //~^ ERROR variable `a` is bound inconsistently
9 let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
10 //~^ ERROR variable `a` is bound inconsistently
11 let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
12 //~^ ERROR variable `a` is bound inconsistently
13 //~| ERROR mismatched types
14 let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
15 //~^ ERROR variable `a` is bound inconsistently
16 //~| ERROR variable `b` is bound inconsistently
17 //~| ERROR mismatched types
20 let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
21 //~^ ERROR variable `a` is bound inconsistently
24 let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1);
25 //~^ ERROR variable `a` is bound inconsistently