Show pattern mismatch diagnostics

This commit is contained in:
Lukas Wirth 2023-02-28 15:13:45 +01:00
parent 9b441b9c67
commit fc2b395e00
8 changed files with 117 additions and 71 deletions

View file

@ -1092,3 +1092,19 @@ fn my_fn(foo: ...) {}
"#,
);
}
#[test]
fn ref_pat_mutability() {
check(
r#"
fn foo() {
let &() = &();
let &mut () = &mut ();
let &mut () = &();
//^^^^^^^ expected &(), got &mut ()
let &() = &mut ();
//^^^ expected &mut (), got &()
}
"#,
);
}