foxtrot icon indicating copy to clipboard operation
foxtrot copied to clipboard

Modernize Codebase to Rust 2024 and Fix Critical CDT Issues

Open virtualritz opened this issue 5 months ago • 0 comments

TLDR; This PR improves stability and maintainability of Foxtrot while bringing it up to current Rust ecosystem standards.

Rust 2024 Edition

  • Updated entire workspace from Rust 2021 to Rust 2024 edition.
  • Fixed all compilation warnings (220+ lifetime elision warnings, 43+ dead code warnings).
  • Applied rustfmt and clippy fixes across all crates.
  • Updated all dependencies to latest compatible versions.

GUI/Rendering

  • Migrated to wgpu v26 and winit v0.30 APIs.
  • Replaced winit event loop with ApplicationHandler trait.
  • Updated WGSL shaders from [[attributes]] to @attributes syntax.
  • Fixed Surface lifetime management with Arc.
  • Handle empty meshes gracefully with early exit and clear error messages.

Bug Fixes

  • Fixed panic in cdt triangulation when processing complex models (e.g., Raspberry Pi 4 STEP file).
  • Replaced assertions with proper error handling using new Error::HullMismatch variant.
  • Added test cases for problematic cdt input that was causing crashes.
  • Fixed buffer panics when models have no vertices or triangles.

Detailed Changes

Express Parser Improvements

  • Fixed nom 7 API compatibility (fold_many0/fold_many1 now use closures).
  • Resolved lifetime issues in alias macro for proper IResult usage.
  • Applied clippy recommendations (renamed methods, removed redundant closures).

Code Quality

  • Renamed parallel feature to rayon and enabled by default.
  • Renamed structs to comply with Rust API naming guidelines (RFC 430).
  • Applied cargo-sort for consistent dependency ordering.

cdt Improvements

  • Merged PR #14 adding test cases for problematic triangulation input.
  • Fixed assertions that would panic on malformed hull structures.
  • Errors are now properly propagated instead of causing crashes.

Testing

  • All existing tests pass.
  • New test cases added for problematic cdt scenarios.
  • Successfully loads and displays complex STEP files that previously crashed.

virtualritz avatar Sep 23 '25 10:09 virtualritz