-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
base: master
Are you sure you want to change the base?
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
This PR changes a file inside |
r? types |
closure | ||
.iter(a_i.0) | ||
.find(|i| closure.contains(*i, a_i.0)) | ||
.map_or(a, |i| self.elements[i]) |
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.
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
?
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.
Borrowck will always have this as a reflexive relation, but the data structure doesn't require that (maybe it should though).
compiler/rustc_borrowck/src/type_check/free_region_relations.rs
Outdated
Show resolved
Hide resolved
@rustbot author (waiting on questions) |
Reminder, once the PR becomes ready for a review, use |
`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.
73464a9
to
c57ef29
Compare
@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 asdyn Any + 'a
in the tests added, is well-formed. In this case we should return 'static.closes #122704
closes #139004