You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add representative unit tests for MIR cast lowering #301
IR-loweringLowering between dialects (dialect-mir to LLVM dialect)QoL-improvementQuality-of-life improvement; not a correctness fixtestsAdds or improves test coverage
crates/mir-lower/src/convert/ops/cast.rs still has a TODO for unit tests around cast conversion.
Cast lowering has many semantic branches and high combinatorial surface area, so this issue should not attempt exhaustive coverage of every source/destination type pair. The goal is to resolve the TODO by adding a small set of representative unit tests that lock down the most important dispatch paths.
Scope
Add focused unit tests for representative mir.cast lowering cases, including:
signed integer widening -> llvm.sext
unsigned integer widening -> llvm.zext
integer narrowing -> llvm.trunc
unsigned integer to float -> llvm.uitofp
signed float to integer -> saturating llvm.fptosi.sat.* intrinsic call
pointer expose address -> llvm.ptrtoint
Non-goals
Do not attempt to cover the full cast matrix.
Do not add niche-encoding or transmute aggregate coverage in this issue.
Do not add unsize/fat-pointer tests in this issue.
Those paths are more specialized and should be tested in separate PRs.
Acceptance criteria
The TODO in cast.rs is replaced with concrete unit tests.
Tests follow the existing convert::ops::test_util pattern: build a minimal MIR module, run lower_mir_to_llvm, and inspect emitted LLVM ops.
Tests verify representative dispatch behavior without expanding into exhaustive combinatorial coverage.
IR-loweringLowering between dialects (dialect-mir to LLVM dialect)QoL-improvementQuality-of-life improvement; not a correctness fixtestsAdds or improves test coverage
Activity