-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Properly suggest deref in else block #79755
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This comment has been minimized.
This comment has been minimized.
r? @davidtwco maybe? |
Can you add a test for this as well? fn main() {
let a = &1;
let b = &2;
let val = if true {
*a
} else if true {
b
} else {
&0
};
} Current output:
|
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.
Could you also add the test requested by @camelid?
@@ -360,6 +360,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
false | |||
} | |||
|
|||
crate fn hir_id_sole_block_element(&self, hir_id: hir::HirId) -> Option<&'tcx hir::Expr<'tcx>> { |
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.
crate fn hir_id_sole_block_element(&self, hir_id: hir::HirId) -> Option<&'tcx hir::Expr<'tcx>> { | |
crate fn maybe_get_block_expr(&self, hir_id: hir::HirId) -> Option<&'tcx hir::Expr<'tcx>> { |
Could you add a doc comment too?
@mibac138 Ping from triage can you please address the comments from the reviewer? |
@mibac138 Ping from triage: any updates on this? |
Triage: |
I can push this to the finish line |
…twco Properly suggest deref in else block Continues rust-lang#79755, fixes rust-lang#79736 r? `@davidtwco`
Fixes #79736