rust/tests/ui/mut/mut-pattern-mismatched.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
563 B
Rust
Raw Normal View History

fn main() {
let foo = &mut 1;
// (separate lines to ensure the spans are accurate)
2015-01-12 06:01:44 +00:00
let &_ //~ ERROR mismatched types
//~| expected mutable reference `&mut {integer}`
//~| found reference `&_`
2016-08-19 23:05:37 +00:00
//~| types differ in mutability
2015-01-07 21:29:48 +00:00
= foo;
let &mut _ = foo;
let bar = &1;
let &_ = bar;
2015-01-12 06:01:44 +00:00
let &mut _ //~ ERROR mismatched types
//~| expected reference `&{integer}`
//~| found mutable reference `&mut _`
2016-08-19 23:05:37 +00:00
//~| types differ in mutability
= bar;
}