]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/rust-analyzer/crates/hir-ty/src/chalk_ext.rs
:arrow_up: rust-analyzer
[rust.git] / src / tools / rust-analyzer / crates / hir-ty / src / chalk_ext.rs
index a9c124b42dc2c112b3a04718f4c0d161fcb00afc..4a5533c6487e48361dd1a94943f7e917c384821e 100644 (file)
@@ -164,6 +164,8 @@ fn callable_sig(&self, db: &dyn HirDatabase) -> Option<CallableSig> {
 
     fn dyn_trait(&self) -> Option<TraitId> {
         let trait_ref = match self.kind(Interner) {
+            // The principal trait bound should be the first element of the bounds. This is an
+            // invariant ensured by `TyLoweringContext::lower_dyn_trait()`.
             TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| {
                 match b.skip_binders() {
                     WhereClause::Implemented(trait_ref) => Some(trait_ref),