-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Make mir borrowck's use of opaque types independent of the typeck query's result #87287
Make mir borrowck's use of opaque types independent of the typeck query's result #87287
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #87141) made this pull request unmergeable. Please resolve the merge conflicts. |
2db308c
to
75d9ed7
Compare
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.
Not sure whether I'm qualified enough to review this, I might be missing something, but there were two parts I didn't understand.
cx.opaque_type_values | ||
let mut opaque_type_values = cx.opaque_type_values; | ||
|
||
for (_, revealed_ty) in &mut opaque_type_values { |
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 does opaque_type_values
contain elements at the start of the loop? It seems to me that the only place where elements were inserted into this field was in the code you deleted below?
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.
yes, but the function where I deleted code is called multiple times. The opaque types are collected over time.
This comment has been minimized.
This comment has been minimized.
3d70dee
to
5156aab
Compare
Looks good to me, |
This comment has been minimized.
This comment has been minimized.
5156aab
to
713044c
Compare
@bors r=spastorino |
📌 Commit 713044c has been approved by |
This comment has been minimized.
This comment has been minimized.
@bors retry |
@bors retry |
@bors r=spastorino |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 713044c has been approved by |
…pes, r=spastorino Make mir borrowck's use of opaque types independent of the typeck query's result fixes rust-lang#87218 fixes rust-lang#86465 we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result. When i removed the `fixup_opaque_types` function in rust-lang#87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information. We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead. r? `@spastorino`
…pes, r=spastorino Make mir borrowck's use of opaque types independent of the typeck query's result fixes rust-lang#87218 fixes rust-lang#86465 we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result. When i removed the `fixup_opaque_types` function in rust-lang#87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information. We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead. r? ``@spastorino``
It used to allow you to mutate the key, even though that can invalidate the map by creating duplicate keys.
I attempted that with the previous code, but I misunderstdood how `shallow_resolve` works.
713044c
to
d103852
Compare
@bors r=spastorino |
📌 Commit d103852 has been approved by |
☀️ Test successful - checks-actions |
…i-obk VecMap::get_value_matching should return just one element r? `@nikomatsakis` Related to rust-lang#86465 and rust-lang#87287
Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution Fixes rust-lang#87455 This situation was unreachable before rust-lang#87287 as we used to just grab the resolved opaque type from typeck and replaced all regions with new inference vars. After rust-lang#87287 we let the `InferCx` in mir borrowck figure out the opaque type all by itself (which it already did before, but it only used the result to sanity check with the typeck result).
Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution Fixes rust-lang#87455 This situation was unreachable before rust-lang#87287 as we used to just grab the resolved opaque type from typeck and replaced all regions with new inference vars. After rust-lang#87287 we let the `InferCx` in mir borrowck figure out the opaque type all by itself (which it already did before, but it only used the result to sanity check with the typeck result).
Mir borrowck does not generate lifetime variables for 'static lifetimes during opaque type resolution Fixes rust-lang#87455 This situation was unreachable before rust-lang#87287 as we used to just grab the resolved opaque type from typeck and replaced all regions with new inference vars. After rust-lang#87287 we let the `InferCx` in mir borrowck figure out the opaque type all by itself (which it already did before, but it only used the result to sanity check with the typeck result).
Concrete regions can show up in mir borrowck if the originated from there We used to not encounter them here, because we took regions from typeck's opaque type resolution by renumbering them. We don't do that anymore. Instead mir borrock does all the logic, and it can handle concrete regions just fine, as long as it created them itself. fixes rust-lang#83190 which was introduced by rust-lang#87287 r? `@spastorino`
fixes #87218
fixes #86465
we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result.
When i removed the
fixup_opaque_types
function in #87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information.We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead.
r? @spastorino