Repository navigation
Require TestContentContext conform to ConvertibleFromBytes. - #2000
Merged
Merged
Conversation
The associated type `TestContentContext` in the `_TestDiscovery` module is constrained to `BitwiseCopyable`. Swift recently introduced `ConvertibleFromBytes` which refines `BitwiseCopyable` and guarantees that conforming types have no uninhabited members (in other words, all bit patterns are valid instances). This PR changes the constraint on `TestContentContext` to `ConvertibleFromBytes`. This improves type safety somewhat by ensuring that a library using `_TestDiscovery` cannot specify a type here that has a trap representation (for instance, `UnsafeRawPointer` and `0x0`) which Swift Testing cannot guard against.
grynspan
requested review from
briancroom,
harlanhaskins,
jerryjrchen and
stmontgomery
as code owners
October 31, 2026 20:12
briancroom
approved these changes
Oct 31, 2026
grynspan
deleted the
jgrynspan/TestContentContext-ConvertibleFromBytes
branch
October 31, 2026 20:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The associated type
TestContentContextin the_TestDiscoverymodule is constrained toBitwiseCopyable. Swift recently introducedConvertibleFromByteswhich refinesBitwiseCopyableand guarantees that conforming types have no uninhabited members (in other words, all bit patterns are valid instances).This PR changes the constraint on
TestContentContexttoConvertibleFromBytes. This improves type safety somewhat by ensuring that a library using_TestDiscoverycannot specify a type here that has a trap representation (for instance,UnsafeRawPointerand0x0) which Swift Testing cannot guard against.Checklist: