Auto merge of #13257 - rust-lang:revert-13147-fix/dyn-ty-inherent-methods, r=lnicola

fix: Fix a crash introduced in #13147

Reverts rust-lang/rust-analyzer#13147

https://github.com/rust-lang/rust-analyzer/actions/runs/3041499441/jobs/4898678721#step:18:62
This commit is contained in:
bors 2022-09-19 09:46:21 +00:00
commit 187bee0bb1

View File

@ -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(),
)?;
}
}
_ => {}
}