The stdlib is always built with NoncopyableGenerics enabled, so `#if
$NoncopyableGenerics` guards in non-inlinable code are superfluous.
Additionally, the stdlib's interface no longer needs to support compilers
without the feature, so the guards in inlinable code can also be removed.
With `NoncopyableGenerics` enabled, we currently lose some ability for
associatedtype inference to find a suitable type witness based on a
value witness. (rdar://118998138)
The stdlib accidentally uses that inference for Sequence.Element,
due to the default witness for `_customContainsEquatableElement`
mentioning `Iterator.Element` whereas the requirement only states
`Element`.
Use a temporary bitset to avoid hashing elements more than once, and to prevent rehashings during the creation of the result set.
This leads to a speedup of about 0-4x, depending on the number of elements removed.
Signed/unsigned integer conversions check for unrepresentable values; this wasn’t recognized as impossible, so a trap got compiled into the Dictionary lookup path.
Note to self: next time just use bitwise operations.
Bitsets implement sorted sets over nonnegative integers up to a predetermined maximum value.
These are intended to replace _UnsafeBitMap. The latter will be removed once its usages are eliminated.
- _UnsafeBitset.Word is the underlying abstraction, implementing a bitset using a single UInt value.
- _UnsafeBitset is a view over a contiguous range of words.
- _Bitset is a COW value type implementing the same construct.