about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-15 07:05:47 +0000
committerbors <bors@rust-lang.org>2024-08-15 07:05:47 +0000
commite20180d0d3cd1cc1a22291940905e18e744852ea (patch)
treea9acfa192ad042ee9418308df76c074576353a20 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent89cd5856d943220fb6f7dde893529aeb4d3fc4ff (diff)
parentb0183f81f4bd9745f4259fb1350202e71931ce34 (diff)
downloadrust-e20180d0d3cd1cc1a22291940905e18e744852ea.tar.gz
rust-e20180d0d3cd1cc1a22291940905e18e744852ea.zip
Auto merge of #17893 - ShoyuVanilla:issue-17871, r=flodiebold
fix: Panic while hovering associated function with type annotation on generic param that not inherited from its container type

Fixes #17871

We call `generic_args_sans_defaults` here;

https://github.com/rust-lang/rust-analyzer/blob/64a140527b383e3a2fe95908881624fc5374c60c/crates/hir-ty/src/display.rs#L1021-L1034

but the following substitution inside that function panic in #17871;

https://github.com/rust-lang/rust-analyzer/blob/64a140527b383e3a2fe95908881624fc5374c60c/crates/hir-ty/src/display.rs#L1468

it's because the `Binders.binder` inside `default_parameters` has a same length with the generics of the function we are hovering on, but the generics of it is split into two, `fn_params` and `parent_params`.
Because of this, it may panic if the function has one or more default parameters and both `fn_params` and `parent_params` are non-empty, like the case in the title of this PR.

So, we must call `generic_args_sans_default` first and then split it into `fn_params` and `parent_params`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions