-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
This PR changes a file inside |
r? types |
@@ -133,7 +133,8 @@ impl UniversalRegionRelations<'_> { | |||
assert!(self.universal_regions.is_universal_region(fr0)); | |||
|
|||
let mut external_parents = vec![]; | |||
let mut queue = vec![fr0]; | |||
|
|||
let mut queue = vec![relation.scc_representative(fr0)]; |
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.
I'm not sure if you've explained why projecting the free region to its representative affects the set of non_local_bounds
that we return. It's not obvious from the definition of TransitiveRelation::parents
, at least.
Like, if these are actually SCC's then I'm not sure why shuffling around which element in that SCC fixes things.
Is there something subtle going on with the fact that 'static
is the first first region vid we allocate?
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.
If it has to do with the fact that TransitiveRelation::parents
requires for us to pass the minimal element for this while loop to actually reach all of the parents, then perhaps we should rename thatfunction to minimal_scc_representative
🤔
Or maybe I'm totally misleading myself.
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.
Hey @matthewjasper, did you mean to resolve this without actually answering the question?
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.
Your second comment was correct and I renamed scc_representative
to minimal_scc_representative
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.
Ah ok thanks
@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 |
@bors r+ |
@bors rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#135562 (Add ignore value suggestion in closure body) - rust-lang#139635 (Finalize repeat expr inference behaviour with inferred repeat counts) - rust-lang#139668 (Handle regions equivalent to 'static in non_local_bounds) - rust-lang#140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths) - rust-lang#140435 (use uX::from instead of _ as uX in non - const contexts) - rust-lang#141130 (rustc_on_unimplemented cleanups) - rust-lang#141286 (Querify `coroutine_hidden_types`) Failed merges: - rust-lang#140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139668 - matthewjasper:upper-bound-fix, r=compiler-errors Handle regions equivalent to 'static in non_local_bounds `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 rust-lang#122704 closes rust-lang#139004
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