Repository navigation
Use typed derive providers in with blocks - #2053
Draft
micahscopes wants to merge 9 commits into
Draft
micahscopes wants to merge 9 commits into
micahscopes wants to merge 9 commits into
Conversation
micahscopes
force-pushed
the
feat/scoped-typed-derive
branch
from
November 20, 2026 22:14
0d02be2 to
29698c8
Compare
micahscopes
force-pushed
the
feat/scoped-typed-derive
branch
from
November 20, 2026 23:06
29698c8 to
cb38eff
Compare
…-scoped-derive-convergence-20261120 # Conflicts: # crates/hir/src/analysis/ty/trait_resolution/derive.rs
…-scoped-derive-convergence-20261120
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing
withblock can now open typed derive providers. Inside the block,Via<Small>forwards the provider forRead<u8>, andLargesuppliesRead<u16>. The calls return 10 and 30. The same two calls outside the block return 1 and 2 from the ordinary implementations.The compiler compares the full trait applications before running a provider. If two providers offer the same application in a block, either order reports the overlap. A selected provider's prerequisites still have to hold. A dot call can use its argument types to finish identifying the application before generation starts.
This builds on typed written derive. The implementation call keeps its full trait application and the proof of its selected provider. If checking reaches an implementation that still needs generation, the compiler records the request and checks again once the generated member has been admitted.
The scoped form applies to a concrete authored record and a trait declared in the requesting package. It requires settled trait arguments and receiver mode. Use a written header for an implementation that supplies an associated type or constant.
The standalone driver checks covered 58 cases. The CLI also checked a projected provider argument that resolves to the same trait application as a directly written argument.