1 // This test ensures that or patterns require binding mode consistency across arms.
3 #![feature(or_patterns)]
4 //~^ WARN the feature `or_patterns` is incomplete
6 #![allow(non_camel_case_types)]
9 let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
10 //~^ ERROR variable `a` is bound in inconsistent ways
11 let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
12 //~^ ERROR variable `a` is bound in inconsistent ways
13 let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
14 //~^ ERROR variable `a` is bound in inconsistent ways
15 //~| ERROR mismatched types
16 let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
17 //~^ ERROR variable `a` is bound in inconsistent ways
18 //~| ERROR variable `b` is bound in inconsistent ways
19 //~| ERROR mismatched types
22 let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
23 //~^ ERROR variable `a` is bound in inconsistent ways
26 let Ok([ Ok((Ok(ref a) | Err(a),)) | Err(a) ]) | Err(a) = Err(&1);
27 //~^ ERROR variable `a` is bound in inconsistent ways