X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=inline;f=src%2Ftools%2Frust-analyzer%2Fcrates%2Fhir-ty%2Fsrc%2Fchalk_ext.rs;h=4a5533c6487e48361dd1a94943f7e917c384821e;hb=c93b07019d024038b07c2e5652971d033b29723c;hp=a9c124b42dc2c112b3a04718f4c0d161fcb00afc;hpb=7098c181f8447810fadb1776d3ffa3cdc93ce402;p=rust.git diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/chalk_ext.rs b/src/tools/rust-analyzer/crates/hir-ty/src/chalk_ext.rs index a9c124b42dc..4a5533c6487 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/chalk_ext.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/chalk_ext.rs @@ -164,6 +164,8 @@ fn callable_sig(&self, db: &dyn HirDatabase) -> Option { fn dyn_trait(&self) -> Option { 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),