2025-04-05 19:19:56 +03:00
|
|
|
//@ dont-require-annotations: NOTE
|
|
|
|
|
|
2014-12-05 15:56:25 -08:00
|
|
|
fn main() {
|
2015-03-03 10:42:26 +02:00
|
|
|
let foo = &mut 1;
|
2014-12-05 15:56:25 -08:00
|
|
|
|
|
|
|
|
// (separate lines to ensure the spans are accurate)
|
|
|
|
|
|
2015-01-12 01:01:44 -05:00
|
|
|
let &_ //~ ERROR mismatched types
|
2025-04-05 19:19:56 +03:00
|
|
|
//~| NOTE expected mutable reference `&mut {integer}`
|
|
|
|
|
//~| NOTE found reference `&_`
|
|
|
|
|
//~| NOTE types differ in mutability
|
2015-01-07 16:29:48 -05:00
|
|
|
= foo;
|
2014-12-05 15:56:25 -08:00
|
|
|
let &mut _ = foo;
|
|
|
|
|
|
2015-03-03 10:42:26 +02:00
|
|
|
let bar = &1;
|
2014-12-05 15:56:25 -08:00
|
|
|
let &_ = bar;
|
2015-01-12 01:01:44 -05:00
|
|
|
let &mut _ //~ ERROR mismatched types
|
2025-04-05 19:19:56 +03:00
|
|
|
//~| NOTE expected reference `&{integer}`
|
|
|
|
|
//~| NOTE found mutable reference `&mut _`
|
|
|
|
|
//~| NOTE types differ in mutability
|
2014-12-05 15:56:25 -08:00
|
|
|
= bar;
|
|
|
|
|
}
|