about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjackh726 <git@jackhuey.me>2025-08-15 03:07:43 +0000
committerjackh726 <git@jackhuey.me>2025-08-15 05:04:41 +0000
commit06336efca9cd5851a72ff43db3641485e0e06a79 (patch)
treeb049f4339d5951808ae107fc414f40d6e8a52aef
parentcc3c5cfb2e46c04778ebba4b0c71e87cb7f7cef7 (diff)
downloadrust-06336efca9cd5851a72ff43db3641485e0e06a79.tar.gz
rust-06336efca9cd5851a72ff43db3641485e0e06a79.zip
add comment
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/next_solver/mapping.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/mapping.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/mapping.rs
index 4696cf479c1..20cd8626f29 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/mapping.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/mapping.rs
@@ -1148,6 +1148,13 @@ pub(crate) fn convert_ty_for_result<'db>(interner: DbInterner<'db>, ty: Ty<'db>)
                         }),
                     );
 
+                    // Rust and chalk have slightly different
+                    // representation for trait objects.
+                    //
+                    // Chalk uses `for<T0> for<'a> T0: Trait<'a>` while rustc
+                    // uses `ExistentialPredicate`s, which do not have a self ty.
+                    // We need to shift escaping bound vars by 1 to accommodate
+                    // the newly introduced `for<T0>` binder.
                     let p = shift_vars(interner, p, 1);
 
                     let where_clause = match p.skip_binder() {