about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/layout.rs9
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs10
2 files changed, 19 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
index 0cb868d273f..81aa16bfdc7 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
@@ -388,6 +388,15 @@ fn struct_tail_erasing_lifetimes(db: &dyn HirDatabase, pointee: Ty) -> Ty {
                 None => pointee,
             }
         }
+        TyKind::Tuple(_, subst) => {
+            if let Some(last_field_ty) =
+                subst.iter(Interner).last().and_then(|arg| arg.ty(Interner))
+            {
+                struct_tail_erasing_lifetimes(db, last_field_ty.clone())
+            } else {
+                pointee
+            }
+        }
         _ => pointee,
     }
 }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
index f671b303807..aac4e94ee36 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
@@ -469,6 +469,16 @@ fn tuple() {
 }
 
 #[test]
+fn tuple_ptr_with_dst_tail() {
+    size_and_align!(
+        struct Goal(*const ([u8],));
+    );
+    size_and_align!(
+        struct Goal(*const (u128, [u8]));
+    );
+}
+
+#[test]
 fn non_zero_and_non_null() {
     size_and_align! {
         minicore: non_zero, non_null, option;