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 00:01:44 -06:00
let &_ //~ ERROR mismatched types
//~| expected mutable reference `&mut {integer}`
//~| found reference `&_`
2016-08-19 18:05:37 -05:00
//~| types differ in mutability
2015-01-07 15:29:48 -06:00
= foo;
let &mut _ = foo;
let bar = &1;
let &_ = bar;
2015-01-12 00:01:44 -06:00
let &mut _ //~ ERROR mismatched types
//~| expected reference `&{integer}`
//~| found mutable reference `&mut _`
2016-08-19 18:05:37 -05:00
//~| types differ in mutability
= bar;
}