]> git.proxmox.com Git - rustc.git/blob - src/test/ui/mut/mut-pattern-mismatched.rs
Update upstream source from tag 'upstream/1.30.0_beta.7+dfsg1'
[rustc.git] / src / test / ui / mut / mut-pattern-mismatched.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 fn main() {
12 let foo = &mut 1;
13
14 // (separate lines to ensure the spans are accurate)
15
16 let &_ //~ ERROR mismatched types
17 //~| expected type `&mut {integer}`
18 //~| found type `&_`
19 //~| types differ in mutability
20 = foo;
21 let &mut _ = foo;
22
23 let bar = &1;
24 let &_ = bar;
25 let &mut _ //~ ERROR mismatched types
26 //~| expected type `&{integer}`
27 //~| found type `&mut _`
28 //~| types differ in mutability
29 = bar;
30 }