Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/patterns.rs')
-rw-r--r--crates/hir-ty/src/tests/patterns.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/patterns.rs b/crates/hir-ty/src/tests/patterns.rs
index 9333e26935..aa1b2a1d9b 100644
--- a/crates/hir-ty/src/tests/patterns.rs
+++ b/crates/hir-ty/src/tests/patterns.rs
@@ -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 &()
+}
+"#,
+ );
+}