about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-15 17:14:13 +0000
committerbors <bors@rust-lang.org>2023-07-15 17:14:13 +0000
commit996e054f1eb1dbfc8455ecabff0f6ff22ba7f7c8 (patch)
tree46a83ba9241dcfc284f982954592d5c9dcdc90a1
parent789dfd2a256e2725d2bcf50cca3e73f0397b91f8 (diff)
parentf8f19c42886aa58c5ac9e463ca060242e7e6ae24 (diff)
downloadrust-996e054f1eb1dbfc8455ecabff0f6ff22ba7f7c8.tar.gz
rust-996e054f1eb1dbfc8455ecabff0f6ff22ba7f7c8.zip
Auto merge of #15288 - alibektas:15143, r=lnicola
Handle TyAlias in projected_ty

First of all I still have no idea how MIR works but #15143 has been an issue that constantly made RA crash so I have been looking for a way to make RA stop panicking. I have zero claims that what I want to merge has any sense or is correct :smile:  but there isn't any more panicking. Even if it is wrong may this be at least a step towards resolving this issue.
As is customary this PR fixes #15143
-rw-r--r--crates/hir-ty/src/mir.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs
index dc846fc3947..df53d239ca5 100644
--- a/crates/hir-ty/src/mir.rs
+++ b/crates/hir-ty/src/mir.rs
@@ -151,6 +151,7 @@ impl<V, T> ProjectionElem<V, T> {
                 TyKind::Adt(_, subst) => {
                     db.field_types(f.parent)[f.local_id].clone().substitute(Interner, subst)
                 }
+                TyKind::Alias(inner) => inner.clone().intern(Interner),
                 _ => {
                     never!("Only adt has field");
                     return TyKind::Error.intern(Interner);
@@ -167,6 +168,7 @@ impl<V, T> ProjectionElem<V, T> {
                         TyKind::Error.intern(Interner)
                     }),
                 TyKind::Closure(id, subst) => closure_field(*id, subst, *f),
+                TyKind::Alias(inner) => inner.clone().intern(Interner),
                 _ => {
                     never!("Only tuple or closure has tuple or closure field");
                     return TyKind::Error.intern(Interner);