Skip to content

fix(rust): decimal culture overloads, and mutables assigned in try/finally - #4918

Merged
ncave merged 2 commits into
fable-compiler:mainfrom
Thorium:fix/rust-runtime-semantics
Aug 29, 2026
Merged

fix(rust): decimal culture overloads, and mutables assigned in try/finally#4918
ncave merged 2 commits into
fable-compiler:mainfrom
Thorium:fix/rust-runtime-semantics

Conversation

@Thorium

@Thorium Thorium commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
  • d.ToString(provider), Decimal.Parse(s, provider) and Decimal.Parse(s, style, provider) now compile. The provider was forwarded to runtime functions that have no parameter for it, so Parse reached a one-argument function and ToString put an IFormatProvider where the decimal belongs. Rust parses and formats invariantly, which is what InvariantCulture asks for, so the culture and style arguments are dropped instead
  • a let mutable assigned in a finally block was mutating a clone of its cell and silently losing the write. try/with/finally now count as the closure contexts they compile into, so the binding is ref-counted like any other captured mutable

The decimal half matters beyond convenience: the culture-less Decimal.Parse compiles but throws under a comma-separator locale such as fi-FI, so a library storing a decimal as text had no supported way to read it back.

…nally

- d.ToString(provider), Decimal.Parse(s, provider) and
  Decimal.Parse(s, style, provider) now compile. The provider was forwarded to
  runtime functions that have no parameter for it, so Parse reached a
  one-argument function and ToString put an IFormatProvider where the decimal
  belongs. Rust parses and formats invariantly, which is what InvariantCulture
  asks for, so the culture and style arguments are dropped instead
- a `let mutable` assigned in a finally block was mutating a clone of its cell
  and silently losing the write. try/with/finally now count as the closure
  contexts they compile into, so the binding is ref-counted like any other
  captured mutable

The decimal half matters beyond convenience: the culture-less Decimal.Parse
compiles but throws under a comma-separator locale such as fi-FI, so a library
storing a decimal as text had no supported way to read it back.
@ncave
ncave merged commit 58ab2d3 into fable-compiler:main Aug 29, 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