-
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
Prefer regions with an external_name
in approx_universal_upper_bound
#78164
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
5d745e3
to
02320d4
Compare
@estebank Are there any changes that you'd like me to make? |
--> $DIR/issue-75785-confusing-named-region.rs:9:5 | ||
| | ||
LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) { | ||
| - let's call the lifetime of this reference `'1` |
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.
ping @estebank for review or reassignment |
@bors r+ Thanks! |
📌 Commit 02320d4b4122d1c5f0ccd4ca7e140a79ec5d9695 has been approved by |
⌛ Testing commit 02320d4b4122d1c5f0ccd4ca7e140a79ec5d9695 with merge d594f0f4b3745bfd16a2c9a005059bdfc4c19e63... |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💔 Test failed - checks-actions |
Fixes rust-lang#75785 When displaying a MIR borrowcheck error, we may need to find an upper bound for a region, which gives us a region to point to in the error message. However, a region might outlive multiple distinct universal regions, in which case the only upper bound is 'static To try to display a meaningful error message, we compute an 'approximate' upper bound by picking one of the universal regions. Currently, we pick the region with the lowest index - however, this caused us to produce a suboptimal error message in issue rust-lang#75785 This PR `approx_universal_upper_bound` to prefer regions with an `external_name`. This causes us to prefer regions from function arguments/upvars, which seems to lead to a nicer error message in some cases.
02320d4
to
419d3ae
Compare
@bors r=tmandry |
📌 Commit 419d3ae has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#78164 (Prefer regions with an `external_name` in `approx_universal_upper_bound`) - rust-lang#80003 (Fix overflow when converting ZST Vec to VecDeque) - rust-lang#80023 (Enhance error message when misspelled label to value in break expression) - rust-lang#80046 (Add more documentation to `Diagnostic` and `DiagnosticBuilder`) - rust-lang#80109 (Remove redundant and unreliable coverage test results) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #75785
When displaying a MIR borrowcheck error, we may need to find an upper
bound for a region, which gives us a region to point to in the error
message. However, a region might outlive multiple distinct universal
regions, in which case the only upper bound is 'static
To try to display a meaningful error message, we compute an
'approximate' upper bound by picking one of the universal regions.
Currently, we pick the region with the lowest index - however, this
caused us to produce a suboptimal error message in issue #75785
This PR
approx_universal_upper_bound
to prefer regions with anexternal_name
. This causes us to prefer regions from functionarguments/upvars, which seems to lead to a nicer error message in some
cases.