Skip to content

fix(rust): F# exceptions, non-exhaustive matches and obj type tests - #4917

Merged
ncave merged 4 commits into
fable-compiler:mainfrom
Thorium:fix/rust-exception-and-typetest-codegen
Aug 30, 2026
Merged

fix(rust): F# exceptions, non-exhaustive matches and obj type tests#4917
ncave merged 4 commits into
fable-compiler:mainfrom
Thorium:fix/rust-exception-and-typetest-codegen

Conversation

@Thorium

@Thorium Thorium commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
  • makeRecord now supplies the synthetic base value, so constructing an F# exception no longer crashes the compiler with "The lists had different lengths"
  • get_Message skips that base field, whose null innerException faulted at runtime
  • MatchFailureException is declared in the runtime library, the way the other targets already get it, so a non-exhaustive match compiles
  • try_downcast returns a value rather than a reference, so :? string as s binds an s that is usable where a string is expected

- makeRecord now supplies the synthetic __base__ value, so constructing an F#
  exception no longer crashes the compiler with "The lists had different lengths"
- get_Message skips that base field, whose null innerException faulted at runtime
- MatchFailureException is declared in the runtime library, the way the other
  targets already get it, so a non-exhaustive match compiles
- try_downcast returns a value rather than a reference, so `:? string as s`
  binds an s that is usable where a string is expected
Comment thread src/Fable.Transforms/Rust/Fable2Rust.fs Outdated
@ncave
ncave merged commit 434b529 into fable-compiler:main Aug 30, 2026
34 checks passed
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