Skip to content

Commit

Permalink
Try to fix crash introduced in #13147
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Sep 19, 2022
1 parent 39eaf78 commit e54f61d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions crates/hir-ty/src/method_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,17 +989,18 @@ fn iterate_inherent_methods(
)?;
}
TyKind::Dyn(_) => {
let principal_trait = self_ty.dyn_trait().unwrap();
let traits = all_super_traits(db.upcast(), principal_trait);
iterate_inherent_trait_methods(
self_ty,
table,
name,
receiver_ty,
receiver_adjustments.clone(),
callback,
traits.into_iter(),
)?;
if let Some(principal_trait) = self_ty.dyn_trait() {
let traits = all_super_traits(db.upcast(), principal_trait);
iterate_inherent_trait_methods(
self_ty,
table,
name,
receiver_ty,
receiver_adjustments.clone(),
callback,
traits.into_iter(),
)?;
}
}
_ => {}
}
Expand Down

0 comments on commit e54f61d

Please sign in to comment.