Skip to content

fix(lexers): keep Rust fractional floats whole before ranges - #1468

Merged
github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:codex/chroma-rust-float-range
Nov 10, 2026
Merged

github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:codex/chroma-rust-float-range

Conversation

@yxshee

@yxshee yxshee commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Rust float fractions drop the last digit when they come before a range:

let exclusive = 1.0..2.0;
let inclusive = 12.345..=67.8;

We currently split up 1.0 into a float of 1. and an int of 0. Need to make sure we pick up the full fraction before .. or ..=. Integer ranges and floats with suffixes / exponents remain unchanged.

The new regression fails on the base with Expected values to be equal and passes with the fix. Fixture + 48 range expressions compiled and ran under rustc. 35 control cases and diff against corpus succeeds. bin/bit -f test, bin/bit -f lint, bin/bit -f check-generated and go test -count=1 ./... all pass.

@github-actions
github-actions Bot enabled auto-merge (squash) November 10, 2026 09:26
@github-actions
github-actions Bot merged commit ff85548 into alecthomas:master Nov 10, 2026
4 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.

1 participant