Skip to content

Prepare COM test fixtures for Send and Sync - #5497

Merged
Kenny Kerr (kennykerr) merged 1 commit into
masterfrom
com-fixture-threading
Nov 25, 2026
Merged

Kenny Kerr (kennykerr) merged 1 commit into
masterfrom
com-fixture-threading

Conversation

@kennykerr

Copy link
Copy Markdown
Collaborator

Update COM implementation fixtures with synchronized state, explicit generic bounds, and thread-safe ownership of retained interfaces. Keep the existing ABI and lifetime coverage, including interface-valued results and collections.

Test-only preparation for #5469. The six affected packages were checked with the proposed Send + Sync bound, but this PR does not enable it or change production crates.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The AgileReference retention and resolution paths still need Windows interop runtime validation, particularly for noexcept self-reference and identity cases, which compile checks alone do not establish.

No open issues 🎉

What changed in this PR

Prepares COM test fixtures for the proposed Send + Sync requirement in #5469. This is test-only work; it does not enable the requirement or change production crates.

Changes:

  • Replace unsynchronized fixture state with atomics and locks, and add explicit generic bounds.
  • Use thread-safe ownership for retained interfaces while preserving ABI and lifetime coverage.
  • Add checks for iterator exhaustion, property type rejection, and retained interface identity.
File Description
crates/​tests/​libs/​interface_core/​tests/​macro_rules_decl.rs Add Send + Sync bounds to generic implementations.
crates/​tests/​libs/​implement/​tests/​vector.rs Separate checked and unsafe construction for retained values.
crates/​tests/​libs/​implement/​tests/​properties.rs Store synchronized integers and reject unsupported variant types.
crates/​tests/​libs/​implement/​tests/​into_impl.rs Synchronize iterator state and test exhausted GetMany calls.
crates/​tests/​libs/​implement/​tests/​data_object.rs Replace mutable call flags with atomics.
crates/​tests/​libs/​implement/​tests/​buffer.rs Protect buffer storage with a mutex.
crates/​tests/​libs/​implement_core/​src/​rust_generic.rs Add thread-safety bounds to the generic factory.
crates/​tests/​libs/​implement_core/​src/​com_object.rs Use an atomic fixture and assert thread-safe ownership.
crates/​tests/​libs/​core/​tests/​unknown.rs Track destruction through shared atomic counters.
crates/​tests/​libs/​bindgen/​src/​ownership_tests.rs Retain thread-safe delegates while preserving owning-result tests.
crates/​tests/​libs/​bindgen/​src/​lib.rs Use atomic lifetime tracking in borrowed-object coverage.
crates/​tests/​libs/​bindgen/​src/​com_results_tests.rs Synchronize provider modes and destruction counters.
crates/​tests/​interop/​fixtures/​structs/​component.rs Store interface-valued fields through agile references.
crates/​tests/​interop/​fixtures/​structs/​client.rs Assert retained interface identity.
crates/​tests/​interop/​fixtures/​noexcept/​component.rs Retain agile references and release replaced values outside locks.
crates/​tests/​interop/​fixtures/​noexcept/​client.rs Apply the same ownership pattern to the client fixture.
crates/​tests/​interop/​fixtures/​native_factory/​component.rs Store opaque handle values as integers.
crates/​tests/​interop/​fixtures/​boxing/​component.rs Retain boxed references through agile ownership.

Review effort: Balanced

@kennykerr
Kenny Kerr (kennykerr) merged commit 5b82d46 into master Nov 25, 2026
51 checks passed
@kennykerr
Kenny Kerr (kennykerr) deleted the com-fixture-threading branch November 25, 2026 19:39
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