-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use a Field
in ConstraintCategory::ClosureUpvar
#94006
Conversation
1b27144
to
041ba10
Compare
This comment has been minimized.
This comment has been minimized.
041ba10
to
87dbccd
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
UI tests passing locally! 🎉 |
030d8ae
to
3c499dd
Compare
3c499dd
to
99e54c7
Compare
@@ -421,17 +421,26 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { | |||
|
|||
diag.span_label(*span, message); | |||
|
|||
// FIXME(project-rfc-2229#48): This should store a captured_place not a 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.
Should we keep this comment?
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.
no, I think it is addressed by using the field actually
@@ -2530,9 +2530,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { | |||
body, | |||
); | |||
let category = if let Some(field) = field { | |||
let var_hir_id = self.borrowck_context.upvars[field.index()].place.get_root_variable(); | |||
// FIXME(project-rfc-2229#8): Use Place for better diagnostics |
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.
Should we keep this comment?
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.
no
99e54c7
to
ec1df02
Compare
ec1df02
to
f41722a
Compare
Conversation regarding correctness of this PR on Zulip:
👍 👍 |
diag.span_label(upvar_def_span, "variable defined here"); | ||
diag.span_label(upvar_span, "variable captured here"); | ||
let captured_place = &self.upvars[upvar_field.index()].place; | ||
let defined_hir = match captured_place.place.base { |
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.
to some extent that comment here to this now, because the thing we've captured is really a full place, not just the base of the place
@@ -2530,9 +2530,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { | |||
body, | |||
); | |||
let category = if let Some(field) = field { | |||
let var_hir_id = self.borrowck_context.upvars[field.index()].place.get_root_variable(); | |||
// FIXME(project-rfc-2229#8): Use Place for better diagnostics |
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.
no
@bors r+ |
📌 Commit f41722a has been approved by |
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#92902 (Improve the documentation of drain members) - rust-lang#93658 (Stabilize `#[cfg(panic = "...")]`) - rust-lang#93954 (rustdoc-json: buffer output) - rust-lang#93979 (Add debug assertions to validate NUL terminator in c strings) - rust-lang#93990 (pre rust-lang#89862 cleanup) - rust-lang#94006 (Use a `Field` in `ConstraintCategory::ClosureUpvar`) - rust-lang#94086 (Fix ScalarInt to char conversion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
As part of #90317, we do not want
HirId
to implementOrd
,PartialOrd
. This line of code has made that difficulthttps://github.com/rust-lang/rust/blob/1b27144afc77031ba9c05d86c06c64485589775a/compiler/rustc_borrowck/src/region_infer/mod.rs#L2184
since it sorts a
ConstraintCategory::ClosureUpvar(HirId)
.This PR makes that variant take a
Field
instead.r? @nikomatsakis