Int128.multipliedFullWidth fails to account for an overflow case, which lead `Duration.components` trapping when the duration is a multiple of 512s.
rdar://96362510
As we have exclusivity checking since a long time, this "explicit" check for inout violations is not needed anymore.
The `_checkInoutAndNativeTypeCheckedBounds` function must remain in the library for backward compatibility.
The remaining relevant subscript index checking from that function is now simply inlined in into the caller.
The documentation publication pipeline doesn't have a way to expose
per-architecture availability, like how it it shows per-platform
availability. So add this in prose instead.
Fixes <rdar://77649895>
We expect indices to be already validated by the time these are
called, and UBP’s debug-mode checks are compiled into opaque parts
of the stdlib.
(The big exception is that Swift <5.7 used to not do proper index
validation and allowed out-of-bounds accesses. We emulate this
behavior for code that was compiled with such a release, and it turns
out that these UnsafeBufferPointer checks are interfering with the
intended (undefined) behavior.)
rdar://93707276
In theory this is a source break if someone had a weird custom
conforming type, but I suspect in practice conformances to
this protocol are never defined.
The reason we want this requirement is that often you will see
code like the following:
protocol Point {
associatedtype Scalar: SIMDScalar
associatedtype Vector: SIMD where Vector.Scalar == Scalar
}
extension Point where Vector == SIMD2<Scalar> { ... }
When `Vector` is equated with `SIMD2<Scalar>`, we get an infinite
sequence of implied same-type requirements:
Vector.MaskStorage == SIMD2<Scalar.MaskScalar>
Vector.MaskStorage.MaskStorage == SIMD2<Scalar.MaskScalar.MaskScalar>
...
The protocol fails to typecheck with an error because the requirement
machine cannot build a rewrite system.
If SIMDScalar requires that MaskScalar.MaskScalar == MaskScalar, then
we instead get
Vector.MaskStorage == SIMD2<Scalar.MaskScalar>
Vector.MaskStorage.MaskStorage == SIMD2<Scalar.MaskScalar>
Vector.MaskStorage.MaskStorage == Vector.MaskStorage
...
Which ties off the recursion.
In theory, a more advanced implementation could represent this kind of
infinite recursion in 'closed form', but we don't have that yet, and I
believe adding this same-type requirement makes sense anyway.
Fixes rdar://problem/95075552.
`Element` is expected to always be `Self`. `RawValue` would be a better choice for the primary type ("option set of UInt32"), but to avoid confusion, it seems better to just omit the declaration, at least for now.
* Implement String.WordView
* Add isWordAligned bit
* Hide WordView for now (also separate Index type)
add bidirectional conformance
Fix tests
* Address comments from Karoy and Michael
* Remove word view, use index methods
* Address Karoy's comments
aaa
If the sequence passed to `Set.intersection` has exactly as many duplicate items as items missing from `self`, then the new implementation in 5.6 will mistakenly return `self` unchanged. (It counts duplicate hits as distinct items in the result.)
rdar://94803458