diff options
| author | bors <bors@rust-lang.org> | 2022-09-19 09:46:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-19 09:46:21 +0000 |
| commit | 187bee0bb100111466a3557c20f80defcc0f4db3 (patch) | |
| tree | 644969d4c5853236957282bdf0e8f2943a344ec8 | |
| parent | 39eaf7864cd786d53e98771864a689ff0f9b9259 (diff) | |
| parent | e54f61dbdb9183cc5fdf58cd098dd783178bc3b9 (diff) | |
| download | rust-187bee0bb100111466a3557c20f80defcc0f4db3.tar.gz rust-187bee0bb100111466a3557c20f80defcc0f4db3.zip | |
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
| -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(), + )?; + } } _ => {} } |
