Skip to content

Prefer regions with an external_name in approx_universal_upper_bound#78164

Merged
bors merged 1 commit intorust-lang:masterfrom
Aaron1011:fix/async-region-name
Dec 18, 2020
Merged

Prefer regions with an external_name in approx_universal_upper_bound#78164
bors merged 1 commit intorust-lang:masterfrom
Aaron1011:fix/async-region-name

Conversation

@Aaron1011
Copy link
Contributor

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 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.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnostics Area: Messages for errors, warnings, and lints S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lifetime error points to wrong reference in async fn return

9 participants