Skip to content

[Rust] Fix missing HashSet implementations and tests#4523

Merged
ncave merged 4 commits intofable-compiler:mainfrom
ncave:rust
Apr 11, 2026
Merged

[Rust] Fix missing HashSet implementations and tests#4523
ncave merged 4 commits intofable-compiler:mainfrom
ncave:rust

Conversation

@ncave
Copy link
Copy Markdown
Collaborator

@ncave ncave commented Apr 10, 2026

  • [Rust] Fix Array/HashMap/HashSet internal repesentation
  • [Rust] Fix missing HashSet implementations and tests

@ncave ncave changed the title Rust [Rust] Fix missing HashSet implementations and tests Apr 10, 2026
@ncave ncave requested a review from Copilot April 10, 2026 19:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Rust backend/library to correctly support HashSet (and related Array/HashMap/HashSet) internal representations and wires up missing HashSet operations, re-enabling/adding cross-target tests to validate behavior.

Changes:

  • Implement missing Rust HashSet set-operations (union/intersect/except/symmetric-except + subset/superset checks) and update the compiler replacements to call into the Rust HashSet module.
  • Refactor Rust library internal representations for NativeArray, HashMap, and HashSet to use LrcPtr<Mut*> wrappers more consistently.
  • Re-enable and extend Rust HashSet tests (including custom comparer scenarios) and adjust some interop tests and test naming consistency across targets.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Rust/tests/src/HashSetTests.fs Re-enables and adds HashSet operation tests (including custom comparer + symmetric-except), plus iteration/fold/count cases.
tests/Rust/tests/src/ExtInteropTests.rs Updates array/vec interop test to match new NativeArray API shape.
tests/Python/TestHashSet.fs Renames a commented test header for consistency (HashSet.IntersectWith...).
tests/Js/Main/HashSetTests.fs Renames a test case label for consistency (HashSet.IntersectWith...).
tests/Dart/src/HashSetTests.fs Renames a commented test label for consistency (HashSet.IntersectWith...).
src/Fable.Transforms/Rust/Replacements.fs Routes HashSet method replacements to the Rust HashSet module for newly supported operations.
src/Fable.Compiler/CHANGELOG.md Adds Rust changelog entries describing the fixes (contains a typo to correct).
src/Fable.Cli/CHANGELOG.md Mirrors Rust changelog entries in CLI changelog (contains the same typo).
src/fable-library-rust/src/NativeArray.rs Changes Array representation to LrcPtr<MutArray<T>> and updates construction/conversion helpers accordingly.
src/fable-library-rust/src/HashSet.rs Refactors HashSet representation and adds missing set-operation implementations.
src/fable-library-rust/src/HashMap.rs Refactors HashMap representation to match the new LrcPtr<Mut*> pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Rust-target runtime collection internals (Array/HashMap/HashSet) and wires up previously-missing HashSet APIs end-to-end (compiler replacements + runtime implementations + tests), aligning Rust behavior with other targets.

Changes:

  • Refactor Rust runtime representations for Array, HashMap, and HashSet to use LrcPtr-based indirection.
  • Implement missing Rust HashSet operations (UnionWith, IntersectWith, ExceptWith, SymmetricExceptWith, Overlaps, SetEquals, CopyTo) and update Rust call replacements accordingly.
  • Re-enable/extend Rust HashSet test coverage and adjust interop + changelog entries.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Rust/tests/src/HashSetTests.fs Uncomments and expands HashSet behavior tests (including comparer-sensitive ops and CopyTo).
tests/Rust/tests/src/ExtInteropTests.rs Updates array/vector interop to new Rust NativeArray API surface.
tests/Python/TestHashSet.fs Renames a commented test label for consistency.
tests/Js/Main/HashSetTests.fs Renames a test case label for consistency.
tests/Dart/src/HashSetTests.fs Renames a commented test case label for consistency.
src/Fable.Transforms/Rust/Replacements.fs Routes HashSet instance methods to Rust HashSet module implementations (incl. CopyTo overload handling).
src/Fable.Compiler/CHANGELOG.md Adds release notes entries for the Rust fixes.
src/Fable.Cli/CHANGELOG.md Adds release notes entries for the Rust fixes.
src/fable-library-rust/src/NativeArray.rs Refactors Array representation to an LrcPtr to a mutable wrapper type.
src/fable-library-rust/src/HashSet.rs Adds missing HashSet operations and refactors internal representation to match new pointer-based layout.
src/fable-library-rust/src/HashMap.rs Refactors internal representation to match new pointer-based layout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Rust backend’s runtime/library implementations to properly support HashSet operations (and related internal representations), and re-enables/adds cross-target tests to validate the behavior.

Changes:

  • Implement missing Rust HashSet operations (UnionWith, IntersectWith, ExceptWith, SymmetricExceptWith, Overlaps, SetEquals, CopyTo overloads, subset/superset checks) and route compiler replacements to them.
  • Adjust Rust Array / HashMap / HashSet internal representations to use LrcPtr<Mut*> patterns consistently.
  • Enable/extend Rust HashSet tests (including custom comparer scenarios) and align a few test names/comments across targets.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Rust/tests/src/HashSetTests.fs Enables/extends HashSet behavioral tests, including comparer-sensitive operations and CopyTo.
tests/Rust/tests/src/ExtInteropTests.rs Updates array/vec interop test to new NativeArray construction/access patterns.
tests/Python/TestHashSet.fs Renames a commented test label for consistency.
tests/Js/Main/HashSetTests.fs Renames test case label for consistency.
tests/Dart/src/HashSetTests.fs Renames commented test case label for consistency.
src/Fable.Transforms/Rust/Replacements.fs Routes HashSet method replacements to Rust HashSet module (incl. CopyTo overload dispatch).
src/Fable.Compiler/CHANGELOG.md Documents Rust fixes in compiler changelog.
src/Fable.Cli/CHANGELOG.md Documents Rust fixes in CLI changelog.
src/fable-library-rust/src/NativeArray.rs Refactors array representation to LrcPtr<MutArray<T>> and updates constructors/conversions.
src/fable-library-rust/src/HashSet.rs Implements missing HashSet methods and refactors representation to LrcPtr<MutHashSet<T>>.
src/fable-library-rust/src/HashMap.rs Refactors representation to LrcPtr<MutHashMap<K,V>> for consistency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ncave ncave merged commit 2594fdd into fable-compiler:main Apr 11, 2026
28 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