feat: add explicit Exn type erasure - #61
Merged
tisonkun merged 2 commits intoAug 24, 2026
Merged
Conversation
tisonkun
marked this pull request as ready for review
August 24, 2026 10:59
Contributor
Author
|
Temporarily closing and reopening to retrigger the required stack-aware CI checks. |
This was referenced Aug 24, 2026
Closed
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.
Depends on
Exn<E>and its marker-only adapters to accept an unsized root markerComplete workflow
This PR makes type erasure useful specifically at boundaries that require one concrete callback error type while callback implementations retain their own typed errors:
The intended flow is therefore:
Exn<E>errors inside each moduleThe same boundary type also allows heterogeneous callback failures to share a collection and be aggregated with
IteratorExt::raiseunder one typed parent.API
ErasedExn = Exn<dyn Error + Send + Sync + 'static>Exn::erase(self) -> ErasedExnDeref<Target = dyn Error + Send + Sync>forErasedExnErasedExngives this common boundary type a standard name without introducing a wrapper or changing its representation. Callers can still define domain-specific aliases such asCallbackExnwhen that improves their API vocabulary.eraseonly changes the compile-time marker. It moves the existingBox<Frame>without allocating, preserves the entire tree, and keeps concrete frame errors available through runtime downcasting.Deliberate omissions
Exn; typed errors remain the default designFrom<Exn<E>> for ErasedExnbecause it makesIteratorExt::raiseinference ambiguous between identity conversion and erasurestd::error::Errorwrapper or tree-to-source()policy; interoperability is independent from marker erasureOpen question
erasethe right consuming-method name, or should it beinto_erased/erased?Validation
cargo x lintcargo x test --no-capture