Skip to content

Handle regions equivalent to 'static in non_local_bounds #139668

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matthewjasper
Copy link
Contributor

non_local_bounds would only find non local bounds that strictly bound a given region, but it's possible that a local region is equated to 'static when showing a type referencing a locally bound lifetime, such as dyn Any + 'a in the tests added, is well-formed. In this case we should return 'static.

closes #122704
closes #139004

@rustbot
Copy link
Collaborator

rustbot commented Apr 11, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 11, 2025

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@compiler-errors
Copy link
Member

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Apr 11, 2025
@rustbot rustbot assigned BoxyUwU and unassigned nnethercote Apr 11, 2025
closure
.iter(a_i.0)
.find(|i| closure.contains(*i, a_i.0))
.map_or(a, |i| self.elements[i])
Copy link
Member

@compiler-errors compiler-errors Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we not find such an element? In other words, what's the justification for the map_or, over an unwrap? Shouldn't all free regions be represented in TransitiveRelations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Borrowck will always have this as a reflexive relation, but the data structure doesn't require that (maybe it should though).

@compiler-errors
Copy link
Member

@rustbot author (waiting on questions)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 13, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

`non_local_bounds` would only find non local bounds that strictly bound a given region,
but it's possible that a local region is equated to 'static when showing a type referencing
a locally bound lifetime, such as `dyn Any + 'a` in the tests added, is well-formed. In
this case we should return 'static.
@matthewjasper
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
5 participants