-
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
Deny non-lifetime bound vars in for<..> ||
closure binders
#108186
Deny non-lifetime bound vars in for<..> ||
closure binders
#108186
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
@@ -52,6 +52,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
) -> Ty<'tcx> { | |||
trace!("decl = {:#?}", closure.fn_decl); | |||
|
|||
deny_non_region_late_bound(self.tcx, closure.bound_generic_params, "closure"); |
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.
All this checks should probably be in rustc_hir_analysis::collect::lifetimes
.
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 attempted to implement something like that. If binder doesn't allow late-bound ty or consts, then it'll resolve to ResolvedArg::Error
instead, so we never actually see these late-bound type or const variables showing up where they shouldn't be.
Not sure if this is what you were looking for.
f4dd264
to
cec7835
Compare
@bors r+ |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#108031 (Don't recover lifetimes/labels containing emojis as character literals) - rust-lang#108046 (Don't allow evaluating queries that were fed in a previous compiler run) - rust-lang#108162 (Don't eagerly convert principal to string) - rust-lang#108186 (Deny non-lifetime bound vars in `for<..> ||` closure binders) - rust-lang#108197 (Update cargo) - rust-lang#108205 (link to llvm changes that prompted the special cases) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Moves the check for illegal bound var types from astconv to resolve_bound_vars. If a binder is defined to have a type or const late-bound var that's not allowed, we'll resolve any usages to ty error or const error values, so we shouldn't ever see late-bound types or consts in places they aren't expected.
Fixes #108184
Fixes #108181
Fixes #108192