Skip to content

refactor: make bare Exn the erased type - #62

Merged
tisonkun merged 3 commits into
codex/explicit-exn-erasurefrom
codex/default-erased-exn
Aug 24, 2026
Merged

refactor: make bare Exn the erased type#62
tisonkun merged 3 commits into
codex/explicit-exn-erasurefrom
codex/default-erased-exn

Conversation

@andylokandy

@andylokandy andylokandy commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Stacked on #61.

Summary

  • make bare Exn default to dyn Error + Send + Sync
  • convert plain errors and typed Exn<E> into bare Exn, allowing ? at erased boundaries
  • simplify IteratorExt::raise to erase child markers through Into<Exn>
  • remove the separate ErasedExn alias and Exn::erase

Design Notes

In a type position, the default parameter makes Into<Exn> equivalent to Into<Exn<dyn Error + Send + Sync + 'static>>.

Concrete errors and Exn<E> values with sized root markers convert into bare Exn, so they work directly with IteratorExt::raise. Bare Exn values use the standard identity conversion. Together these cover the supported typed and erased states.

The ?Sized marker bounds allow the standard erased dyn Error + Send + Sync default without reallocating or changing the exception tree. This PR does not provide conversion to arbitrary custom trait-object markers such as Exn<dyn CustomError>.

Validation

  • cargo x lint
  • cargo x test --no-capture
  • integration coverage for automatic callback erasure, typed and erased iterator items, allocation reuse, and runtime downcasting

@tisonkun
tisonkun merged commit 2732794 into main Aug 24, 2026
12 checks passed
@tisonkun
tisonkun deleted the codex/default-erased-exn branch August 24, 2026 12:15
This was referenced Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants