mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
fix: sort all bounds on trait object types
This commit is contained in:
parent
67920f7975
commit
265c75c53f
3 changed files with 81 additions and 22 deletions
|
@ -164,6 +164,8 @@ impl TyExt for Ty {
|
|||
|
||||
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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue