Repository navigation
Proof of Concept: enforced homogeneity for Try (& Poll) - #163637
MusicalNinjaDad wants to merge 9 commits into
Conversation
aa05e45 to
a82da97
Compare
This comment has been minimized.
This comment has been minimized.
a82da97 to
e8af9c3
Compare
This comment has been minimized.
This comment has been minimized.
e8af9c3 to
4a64637
Compare
This comment has been minimized.
This comment has been minimized.
9021ab3 to
17983e5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ae9da4a to
9bce5a8
Compare
This comment has been minimized.
This comment has been minimized.
traits with associated lang items
9bce5a8 to
e9d0fe5
Compare
This comment has been minimized.
This comment has been minimized.
e9d0fe5 to
a17f464
Compare
This comment has been minimized.
This comment has been minimized.
a17f464 to
bd3608a
Compare
This comment has been minimized.
This comment has been minimized.
bd3608a to
9fa6156
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
FIXME this needs to be reverted and done properly if the overall approach is sound
try_fold is stable but relies on unstable trait Try. add a dedicated qmark! macro which performs future desugaring in a stable context. This is sound because only stdlib can name and use Try in a stable context. All third-party implementations of try_fold must be unstable and make use of feature(try_trait_v2) in order to name Try. This does not introduce any new risks, any adjustments to unstable `Try` already need to consider the impact on try_fold. All other try_xxx methods in stdlib are unstable.
to explicitly use modern desugaring
to use qmark! get_or_try_insert_with is currently unstable and is the only such method which relies on `?`. All other unstable `try_xxx` methods manually implement a match on Try::branch.
This reverts commit 0f9e216.
9fa6156 to
9d3e7b5
Compare
|
r? @tmandry can you please set up a crater run for this. Thanks! |
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Proof of Concept: enforced homogeneity for Try (& Poll)
|
@craterbot run mode=check-only start=8d1a76430406c877b35d0b627e7f796dcf0dfeca+rustflags=-Aunfulfilled-lint-expectations end=8773d2c75a8e90130dcce745a7ec4e66bb9963db+rustflags=-Aunfulfilled-lint-expectations
|
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
☔ The latest upstream changes (presumably #164005) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
View all comments
This is a draft PR targeted at a crater run to validate the viability of enforcing homogeneity for
Try. See #155368, #84277 & rust-lang/goals#654.If successful, this will feed into a near-future design meeting on the key open points for stabilising
Try. I will organise a design meeting once the crater results are available.Requesting a crater run to validate the following points
homogeneous
PollThis is not expected to produce any regressions in stable code.
?desugaring has been gated to use non-homogeneousPollunlessfeature(try_trait_v2)is enabled. See zulip: #t-lang/try > impl Try for std::task::Poll for more details & discussion.Iterator::try_foldPotential source of regression, low risk.
try_foldis currently stable and names the unstabletrait Tryin its signature, this means that gated?desugaring cannot be leveraged. There is a potential for crater regressions in the case thattry_foldis used on an iterator ofPoll<Result<_,_>orPoll<Option<Result<_,_>>; I cannot conceive a viable use-case for doing this as it would require silently ignoring & throwing away anyPending/Ready(None)cases during folding.enforced homogeneity
This is not expected to produce any regressions in stable code.
Only stdlib can name
Tryetc in stable code.x testpasses locally, any regressions should be caught by the full CI test run & bors build before crater.TODOs - this is a draft PR for the following reasons
Tryis fixed to an edition boundary. All unstabletry_...features should not stabilise beforetry_trait_v2try_trait_v2flagged as unused if only needed for desugaringLLM statement
Confirmed no LLM usage.