]>
git.proxmox.com Git - rustc.git/blob - tests/ui/or-patterns/inconsistent-modes.rs
1 // This test ensures that or patterns require binding mode consistency across arms.
3 #![allow(non_camel_case_types)]
6 let (Ok(a
) | Err(ref a
)): Result
<&u8, u8> = Ok(&0);
7 //~^ ERROR variable `a` is bound inconsistently
8 let (Ok(ref mut a
) | Err(a
)): Result
<u8, &mut u8> = Ok(0);
9 //~^ ERROR variable `a` is bound inconsistently
10 let (Ok(ref a
) | Err(ref mut a
)): Result
<&u8, &mut u8> = Ok(&0);
11 //~^ ERROR variable `a` is bound inconsistently
12 //~| ERROR mismatched types
13 let (Ok((ref a
, b
)) | Err((ref mut a
, ref b
))) = Ok((0, &0));
14 //~^ ERROR variable `a` is bound inconsistently
15 //~| ERROR variable `b` is bound inconsistently
16 //~| ERROR mismatched types
19 let (Ok(Ok(a
) | Err(a
)) | Err(ref a
)) = Err(0);
20 //~^ ERROR variable `a` is bound inconsistently
23 let (Ok([Ok((Ok(ref a
) | Err(a
),)) | Err(a
)]) | Err(a
)) = Err(&1);
24 //~^ ERROR variable `a` is bound inconsistently