]> git.lizzy.rs Git - rust.git/commitdiff
Merge #9954
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Wed, 1 Sep 2021 09:26:10 +0000 (09:26 +0000)
committerGitHub <noreply@github.com>
Wed, 1 Sep 2021 09:26:10 +0000 (09:26 +0000)
9954: feat: Show try operator propogated types on ranged hover  r=matklad a=Veykril

Basically this just shows the type of the inner expression of the `?` expression as well as the type of the expression that the `?` returns from:
![Code_wIrCxMqLH9](https://user-images.githubusercontent.com/3757771/130111025-f7ee0742-214a-493b-947a-b4a671e4be92.png)

Unless both of these types are `core::result::Result` in which case we show the error types only.
![Code_Xruw5FCBNI](https://user-images.githubusercontent.com/3757771/130111024-f9caef82-92e4-4070-b3dd-f2ff9e5d87a9.png)

If both types are `core::option::Option` with different type params we do not show this special hover either as it would be pointless(instead fallback to default type hover)

Very much open to changes to the hover text here(I suppose we also want to show the actual type of the `?` expression, that is its output type?).

Fixes #9931

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
1  2 
crates/ide/src/hover.rs

Simple merge