Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/lower/tests.rs')
-rw-r--r--crates/hir-ty/src/mir/lower/tests.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir/lower/tests.rs b/crates/hir-ty/src/mir/lower/tests.rs
index 8e10284cc1..d8f7d549d6 100644
--- a/crates/hir-ty/src/mir/lower/tests.rs
+++ b/crates/hir-ty/src/mir/lower/tests.rs
@@ -108,3 +108,29 @@ pub struct AssocTy {
"#,
);
}
+
+#[test]
+fn borrowck_tuple_field_projection_recovery_does_not_panic() {
+ check_borrowck(
+ r#"
+//- minicore: sized
+fn tuple_field() {
+ let t = (1,);
+ let x = t.1;
+}
+ "#,
+ );
+}
+
+#[test]
+fn borrowck_alias_projection_recovery_does_not_panic() {
+ check_borrowck(
+ r#"
+//- minicore: sized
+trait Tr { type A; }
+fn alias<T: Tr>(x: T::A) {
+ let (a, b) = x;
+}
+ "#,
+ );
+}