-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Prevent infinite (exponential) recursion in only_used_in_recursion #8691
Prevent infinite (exponential) recursion in only_used_in_recursion #8691
Conversation
This simplifies the visitor code a bit and prevents checking expressions multiple times. I still think this lint should be removed for now, because its code isn't really tested.
r? @Manishearth (rust-highfive has picked a reviewer for you, use r? to override) |
r? @llogiq |
} | ||
|
||
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) { | ||
if !self.visited_exprs.insert(ex.hir_id) { | ||
return; | ||
} | ||
match ex.kind { | ||
ExprKind::Array(exprs) | ExprKind::Tup(exprs) => { |
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 example for missing tests: This whole arm could be removed completely and the tests keep passing, even though this changes the semantics of the lint.
Thank you! That's what I would have done there, too. @bors r+ |
📌 Commit 214fba7 has been approved by |
That still stands. But let's talk about this on Zulip |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This simplifies the visitor code a bit and prevents checking expressions
multiple times. I still think this lint should be removed for now,
because its code isn't really tested.
Fixes #8689
NOTE: Before merging this, we should talk about removing and revisiting this lint. See my comment in #8689
changelog: prevent infinite recursion in [
only_used_in_recursion
]