-
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
Don't ICE when no bound vars found while doing closure hir type check #113396
Don't ICE when no bound vars found while doing closure hir type check #113396
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
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.
I don't think is the correct solution. Rust will still ICE if the closure has >0 inputs.
This PR also needs more description. It should at least briefly explain why this fixes the issue and/or why it's correct.
@rustbot author |
☔ The latest upstream changes (presumably #113591) made this pull request unmergeable. Please resolve the merge conflicts. |
@lenko-d any updates on this? thanks |
@Dylan-DPC I'm still working on this occasionally. I believe that I have some understanding of what the problem is. I believe that the problem is that the closure is not visited when the HIR gets traversed in hir_analysis -> collect -> resolve_bound_vars. Not sure yet why it is not visited and how to fix it. |
6920064
to
241c75f
Compare
for param in bound_generic_params { | ||
match param.kind { | ||
GenericParamKind::Lifetime { .. } => {} | ||
GenericParamKind::Type { default, .. } => { | ||
if let Some(ty) = default { | ||
self.visit_ty(ty); | ||
} | ||
} | ||
GenericParamKind::Const { ty, default } => { | ||
self.visit_ty(ty); | ||
if let Some(default) = default { | ||
self.visit_body(self.tcx.hir().body(default.body)); | ||
} | ||
} | ||
} | ||
} |
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 is generally the correct fix.
Though I feel like this could be merged with the same logic for handling lifetimes in const defaults in item generics (#93669). Maybe you could move the visit_ty
and visit_body
calls into visit_generic_param
, and then this can be replaced with:
for param in bound_generic_params { | |
match param.kind { | |
GenericParamKind::Lifetime { .. } => {} | |
GenericParamKind::Type { default, .. } => { | |
if let Some(ty) = default { | |
self.visit_ty(ty); | |
} | |
} | |
GenericParamKind::Const { ty, default } => { | |
self.visit_ty(ty); | |
if let Some(default) = default { | |
self.visit_body(self.tcx.hir().body(default.body)); | |
} | |
} | |
} | |
} | |
walk_list!(self, visit_generic_param, bound_generic_params); |
…id ICE on no bound vars.
241c75f
to
a1d181d
Compare
@rustbot ready |
@bors r+ |
…for_lifetime_binders, r=compiler-errors Don't ICE when no bound vars found while doing closure hir type check The problem was that we were not visiting the const generic default argument in a bound where predicate when the HIR gets traversed in hir_analysis -> collect -> resolve_bound_vars. Fixes [112574](rust-lang#112574)
💔 Test failed - checks-actions |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
@bors retry |
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
Finished benchmarking commit (1cbfeab): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 632.116s -> 631.251s (-0.14%) |
The problem was that we were not visiting the const generic default argument in a bound where predicate when the HIR gets traversed in hir_analysis -> collect -> resolve_bound_vars.
Fixes 112574