-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rework applying closure requirements in borrowck #102618
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
fc12ee6
to
f69db63
Compare
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a` | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` |
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 another minor diagnostic regression, but I believe it never was an intended behavior of the previous setup. Actually at the point of rendering diagnostics the intention was to not have a constraint with ClosureBounds
category, but here we've somehow missed converting ClosureBounds
constraints.
Anyway this regression only affect the niche case where there is double lifetime bounds in assoc type definition (Trait<'a, 'b>::Assoc: 'a + 'b
) AND the bound X: Trait<'a, 'a>
appears in param env.
☔ The latest upstream changes (presumably #102948) made this pull request unmergeable. Please resolve the merge conflicts. |
f69db63
to
4ddd1eb
Compare
☔ The latest upstream changes (presumably #103220) made this pull request unmergeable. Please resolve the merge conflicts. |
4ddd1eb
to
1e5eba9
Compare
r? @compiler-errors who recently touched promoted closure constraints. Feel free to reassign. |
☔ The latest upstream changes (presumably #103962) made this pull request unmergeable. Please resolve the merge conflicts. |
This change makes sense to me, and the second commit does have some good diagnostics improvements. r=me after rebasing. |
Don't use `ConstraintCategory::ClosureBounds`! Set the category and the span for the promoted constraints to that of the original constraint earlier than before. This eliminates the need for `closure_bounds_mapping`.
Spans are independent of the body being borrow-checked, so they don't need remapping when promoting type-tests and they yield more specific error spans inside bodies of closures/inline consts.
1e5eba9
to
02f78fd
Compare
@bors r=compiler-errors |
@aliemjay: 🔑 Insufficient privileges: Not in reviewers |
Ah no bors delegate command, then ping @compiler-errors to review. |
@bors r=compiler-errors |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e30fb6a): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
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.
CyclesResultsThis 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.
|
Changes in performance are probably noise given the set of benchmarks. |
…=compiler-errors rework applying closure requirements in borrowck Previously the promoted closure constraints were registered under the category `ConstraintCategory::ClosureBounds` in `type_check::prove_closure_bounds()` and then mapped back their original category in `regions_infer::best_blame_constraint` using the complicated map `closure_bounds_mapping`. Now we're registering promoted constraints under their original category and span earlier in `type_check::prove_closure_bounds`. See commit messages. Fixes rust-lang#99245
Previously the promoted closure constraints were registered under the category
ConstraintCategory::ClosureBounds
intype_check::prove_closure_bounds()
and then mapped back their original category inregions_infer::best_blame_constraint
using the complicated mapclosure_bounds_mapping
.Now we're registering promoted constraints under their original category and span earlier in
type_check::prove_closure_bounds
.See commit messages.
Fixes #99245