about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-06 12:33:50 +0000
committerbors <bors@rust-lang.org>2022-10-06 12:33:50 +0000
commita415fb4c4e00da1b4138f5a7787ae9838e8ab576 (patch)
treefee8741da88aacdb4e467529d43ccf33315806d3
parentf2f3528618a1fb280fbef1a12e7502a28430a822 (diff)
parent8862fe6ff25c209ec4c027f0c253005ec3a9e3e0 (diff)
downloadrust-a415fb4c4e00da1b4138f5a7787ae9838e8ab576.tar.gz
rust-a415fb4c4e00da1b4138f5a7787ae9838e8ab576.zip
Auto merge of #13353 - wildbook:fix_type_inference_panic, r=Veykril
Fix assertion failure in type inference (#13352)

Fixes https://github.com/rust-lang/rust-analyzer/issues/13352
-rw-r--r--crates/hir/src/lib.rs4
-rw-r--r--crates/ide/src/highlight_related.rs16
2 files changed, 20 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index e08dd8dadeb..f5324208c9a 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -2807,6 +2807,10 @@ impl Type {
                     let subst = TyBuilder::subst_for_def(db, id, None).fill_with_unknown().build();
                     Some(subst)
                 }
+                ItemContainerId::ImplId(id) => {
+                    let subst = TyBuilder::subst_for_def(db, id, None).fill_with_unknown().build();
+                    Some(subst)
+                }
                 _ => None,
             },
             _ => None,
diff --git a/crates/ide/src/highlight_related.rs b/crates/ide/src/highlight_related.rs
index 1bdd626f1e8..540a115832d 100644
--- a/crates/ide/src/highlight_related.rs
+++ b/crates/ide/src/highlight_related.rs
@@ -1376,4 +1376,20 @@ fn main() {
 "#,
         );
     }
+
+    #[test]
+    fn test_assoc_type_highlighting() {
+        check(
+            r#"
+trait Trait {
+    type Output;
+      // ^^^^^^
+}
+impl Trait for () {
+    type Output$0 = ();
+      // ^^^^^^
+}
+"#,
+        );
+    }
 }