diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2022-09-19 12:45:38 +0300 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2022-09-19 12:45:38 +0300 |
| commit | e54f61dbdb9183cc5fdf58cd098dd783178bc3b9 (patch) | |
| tree | 644969d4c5853236957282bdf0e8f2943a344ec8 | |
| parent | 39eaf7864cd786d53e98771864a689ff0f9b9259 (diff) | |
| download | rust-e54f61dbdb9183cc5fdf58cd098dd783178bc3b9.tar.gz rust-e54f61dbdb9183cc5fdf58cd098dd783178bc3b9.zip | |
Try to fix crash introduced in #13147
| -rw-r--r-- | crates/hir-ty/src/method_resolution.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs index dbf27500320..41fcef73d9b 100644 --- a/crates/hir-ty/src/method_resolution.rs +++ b/crates/hir-ty/src/method_resolution.rs @@ -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(), + )?; + } } _ => {} } |
