-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Normalize opaques with late-bound vars again #113108
Normalize opaques with late-bound vars again #113108
Conversation
cc @rust-lang/types, I don't think this needs an FCP since this doesn't affect the type system in an observable way other than fixing potential ICEs -- I guess should be more of a T-compiler PR (but did r? for types because y'all have context). Just letting y'all know in case someone has strong opinions about this PR. |
This comment was marked as resolved.
This comment was marked as resolved.
@bors r+ rollup=never |
⌛ Testing commit bfc6ca8 with merge 7bace13bbc0bea3688dfc3e8f37f104787e05790... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
⌛ Testing commit bfc6ca8 with merge ad0d2e8896479710a73570a24714b05ab5104957... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry mips core dump? |
⌛ Testing commit bfc6ca8 with merge 4cd4b2f45634472196bf80a3945d312c9a9962cc... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a20a04e): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 662.766s -> 660.963s (-0.27%) |
Attempt to abstract sync and async requests by writing an abstraction over the flow of data that encompasses a request. The requests fill out a `RequestData` instance which then gets used as the source of future transformations. The login chain is a prime example of this. We define a series of steps that are expressed as a series of sequences which will finally produce the expected outcome. The Session now produces a `Sequence` implementation which needs to be driven by a client. Unfortunately, due to lack of Async Trait support, the async implementation is not as efficient as it could be. Attempt was made to test the code on nightly, but ran into this bug rust-lang/rust#113108
Attempt to abstract sync and async requests by writing an abstraction over the flow of data that encompasses a request. The requests fill out a `RequestData` instance which then gets used as the source of future transformations. The login chain is a prime example of this. We define a series of steps that are expressed as a series of sequences which will finally produce the expected outcome. The Session now produces a `Sequence` implementation which needs to be driven by a client. Unfortunately, due to lack of Async Trait support, the async implementation is not as efficient as it could be. Attempt was made to test the code on nightly, but ran into this bug rust-lang/rust#113108
We have a hack in the compiler where if an opaque has escaping late-bound vars, we skip revealing it even though we could reveal it from a technical perspective. First of all, this is weird, since we really should be revealing all opaques in
Reveal::All
mode. Second of all, it causes subtle bugs (linked below).I attempted to fix this in #100980, which was unfortunately reverted due to perf regressions on codebases that used really deeply nested futures in some interesting ways. The worst of which was #103423, which caused the project to hang on build. Another one was #104842, which was just a slow-down, but not a hang. I took some time afterwards to investigate how to rework
normalize_erasing_regions
to take advantage of better caching, but that effort kinda fizzled out (#104133).However, recently, I was made aware of more bugs whose root cause is not revealing opaques during codegen. That made me want to fix this again -- in the process, interestingly, I took the the minimized example from #103423 (comment), and it doesn't seem to hang any more...
Thinking about this harder, there have been some changes to the way we lower and typecheck async futures that may have reduced the pathologically large number of outlives obligations (see description of #103423) that we were encountering when normalizing opaques with bound vars the last time around:
GenFuture
shim when compiling async constructs #104321 (lowerasync { .. }
directly as a generator that implementsFuture
, removing thefrom_generator
shim)identity_future
indirection #104833 (removing anidentity_future
fn that was wrapping desugared future generators)... so given that I can see:
... and given that this PR:
TypeMap
! #109464DefiningAnchor::Bubble
from codegen (75a8f68)I'm inclined to give this another shot at landing this. Best case, it just works -- worst case, we get more examples to study how we need to improve the compiler to make this work.
r? types