Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/simple.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/simple.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/simple.rs b/crates/hir-ty/src/tests/simple.rs index 535b948371..5b08f55210 100644 --- a/crates/hir-ty/src/tests/simple.rs +++ b/crates/hir-ty/src/tests/simple.rs @@ -3043,3 +3043,30 @@ fn main() { "#, ); } + +#[test] +fn destructuring_assignment_type_mismatch_on_identifier() { + check( + r#" +struct S { v: i64 } +struct TS(i64); +fn main() { + let mut a: usize = 0; + (a,) = (0i64,); + //^expected i64, got usize + + let mut a: usize = 0; + [a,] = [0i64,]; + //^expected i64, got usize + + let mut a: usize = 0; + S { v: a } = S { v: 0 }; + //^expected i64, got usize + + let mut a: usize = 0; + TS(a) = TS(0); + //^expected i64, got usize +} + "#, + ); +} |