-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Show try operator propogated types on ranged hover #9954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
r? @matklad |
matklad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks plausible to me!
One potentail issue here is that hover is the largest (in terms of binary size) function in the ide crate. We might want to try to add mode software engineering here, and split this up in modules.
It does seem that hover works roughly by "let's compute this n bits of info, and then combine then into one string". It would be cool if each of n bit was serpatate module, and if they returned some rust Structs with hir types, with the top-level doing actual rendering.
r=me
| infer::{Adjust, Adjustment, AutoBorrow}, | ||
| infer::{ | ||
| Adjust, Adjustment, AutoBorrow, BindingMode, Expectation, InferenceContext, TypeMismatch, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 drive by changes are ok if they make code consistent with the style guide!
|
Ye adding some deref thingy there sounds reasonable. Another thing, we should also probably mention iterator item types for iterator types as well.
I only know it as a reborrow, haven't heard a specific name like that for it yet 😄 |
|
bors r=matklad |

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:Unless both of these types are

core::result::Resultin which case we show the error types only.If both types are
core::option::Optionwith 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