summaryrefslogtreecommitdiffstats
path: root/tests/ui/mut/mut-pattern-mismatched.rs
blob: 700261fe40b65ad9a473b00eba39c8190a59933a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn main() {
    let foo = &mut 1;

    // (separate lines to ensure the spans are accurate)

     let &_ //~  ERROR mismatched types
            //~| expected mutable reference `&mut {integer}`
            //~| found reference `&_`
            //~| types differ in mutability
        = foo;
    let &mut _ = foo;

    let bar = &1;
    let &_ = bar;
    let &mut _ //~  ERROR mismatched types
               //~| expected reference `&{integer}`
               //~| found mutable reference `&mut _`
               //~| types differ in mutability
         = bar;
}