fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
813 B35 linesraw
1// run-rustfix
2#![allow(dead_code)]
3
4struct A {
5    b: B,
6}
7
8enum B {
9    Fst,
10    Snd,
11}
12
13union Foo {
14    bar: u32,
15    qux: f32,
16}
17
18fn main() {
19    let a = A { b: B::Fst };
20    if let B::Fst = a.b {}; //~ ERROR mismatched types [E0308]
21    //~^ HELP you might have meant to use field `b` whose type is `B`
22    match a.b {
23        //~^ HELP you might have meant to use field `b` whose type is `B`
24        //~| HELP you might have meant to use field `b` whose type is `B`
25        B::Fst => (), //~ ERROR mismatched types [E0308]
26        B::Snd => (), //~ ERROR mismatched types [E0308]
27    }
28
29    let foo = Foo { bar: 42 };
30    match unsafe { foo.bar } {
31        //~^ HELP you might have meant to use field `bar` whose type is `u32`
32        1u32 => (), //~ ERROR mismatched types [E0308]
33        _ => (),
34    }
35}