-
Notifications
You must be signed in to change notification settings - Fork 14k
Move object lifetime default computation #97839
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
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 this is the right index here.
jackh726
left a comment
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.
Some initial comments.
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.
This comment should be removed, I think.
compiler/rustc_typeck/src/collect.rs
Outdated
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.
Hmm. Is this true? I could imagine a scenario like
struct Foo<'a, T: 'a> {}
trait Bar {}
let _: for<'x> fn(Foo<'x, dyn Bar>);Does that apply here?
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.
This code is only used for function item-likes.
I agree, this is slightly wrong. However, this cannot cause a bug: ImplicitObjectLifetimeDefault can only reference a lifetime from an outer & reference, a generic argument, or 'static. So the lifetime this references has already been seen by the visitor.
However, this whole visitor will be useless once #97720 lands. All the lifetimes in a function's signature will be generic parameters, so only the loop in has_late_bound_regions will be required.
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.
Is this description correct?
It's probably worth elaborating a bit in a comment what the different between object_lifetime_map and object_lifetime_defaults are.
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.
It's probably worth elaborating a bit in a comment what the different between
object_lifetime_mapandobject_lifetime_defaultsare.
This is still relevant
src/test/ui/issues/issue-41139.rs
Outdated
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 did this change? Not a huge deal, but would be nice to know why
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.
This is a bug.
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.
Wait, do you mean the existing test is a bug? Or the new output is?
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.
The new output is buggy.
fa5dff6 to
fc2713e
Compare
This comment has been minimized.
This comment has been minimized.
fc2713e to
5d5eda8
Compare
|
Gonna try to take another look at this PR this weekend. |
jackh726
left a comment
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.
Looking pretty good. Just two small comments. Also, can you merge some commits (pacify tidy, fix comments and query description) into other relevant commits. Not required, but would be nice. r=me after review addressed
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.
It's probably worth elaborating a bit in a comment what the different between
object_lifetime_mapandobject_lifetime_defaultsare.
This is still relevant
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.
s/not/be?
5d5eda8 to
1f535a0
Compare
This comment has been minimized.
This comment has been minimized.
1f535a0 to
37f42cb
Compare
|
I'm having doubts whether this is the right direction. I'm marking this as blocked until I have a proper idea of where we are going. |
|
☔ The latest upstream changes (presumably #97313) made this pull request unmergeable. Please resolve the merge conflicts. |
…r-errors Remove separate indexing of early-bound regions ~Based on rust-lang#99728 This PR copies some modifications from rust-lang#97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
…r-errors Remove separate indexing of early-bound regions ~Based on rust-lang#99728 This PR copies some modifications from rust-lang#97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
Split from #97393
r? @jackh726