-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Diagnostic tweaks #85102
Diagnostic tweaks #85102
Conversation
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
if expected_ty == self.tcx.types.bool { | ||
// If this is caused by a missing `let` in a `while let`, | ||
// silence this redundant error, as we already emit E0070. | ||
let parent = self.tcx.hir().get_parent_node(blk.hir_id); |
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.
this code seems really fragile 🤔
can you instead check the parent which should be a Match
expr with MatchSource::WhileDesugar
? at least that's what i expect
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.
We can't do this because this is not a WhileDesugar
. It would be if we had an while let
, but we instead have an while
.
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.
An alternative would be to keep global state with all of the HirIds for which we should silence these errors 🤔
I am not able to review any PRs in the near future. r? @varkor |
This comment has been minimized.
This comment has been minimized.
695ac5e
to
4ed4719
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
028eed7
to
4791472
Compare
This comment has been minimized.
This comment has been minimized.
173b6cd
to
8ffc3ae
Compare
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
Clippy tests need an update:
|
* Do not emit unnecessary E0308 after E0070 * Show fewer errors on `while let` missing `let` * Hide redundant E0308 on `while let` missing `let` * Point at binding definition when possible on invalid assignment * do not point at closure twice * do not suggest `if let` for literals in lhs * account for parameter types
d4e5cf4
to
2e1792a
Compare
@bors r=oli-obk |
📌 Commit 2e1792a has been approved by |
…-obk Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
…-obk Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
…-obk Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
☀️ Test successful - checks-actions |
Finished benchmarking commit (9adfd9d): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
while let
whenlet
is missing in some cases