The `CollectionDifference` type has a few different invariants
that were not being validated when initializing using the type's
`Decodable` conformance, since the type was using the
autogenerated `Codable` implementation. This change provides
manual implementations of the `Encodable` and `Decodable`
requirements, and adds tests that validate the failure when trying
to decode invalid JSON for CollectionDifference (and a few other
types).
This tends to be generally through for most `description` properties, but explicitly calling it out should help preventing people from trying to parse the result in this case.
This makes ManagedBuffer available and usable in Embedded Swift, by:
- Removing an internal consistency check from ManagedBuffer that relies on metatypes.
- Making the .create() API transparent (to hoist the metatype to the callee).
- Adding a AllocRefDynamicInst simplification to convert `alloc_ref_dynamic` to `alloc_ref`, which removes a metatype use.
- Adding tests for the above.
* Add non-inout `_withUnprotectedUnsafePointer`
For withUnsafePointer we have both an inout and a borrowing form, allowing it to be used with immutable values. Add a parallel form for the unprotected variant.
* Update LifetimeManager.swift
`_mangledTypeName()` returns the Swift-mangled typename of a given type. This PR extends it to take non-copyable types as well.
Related to our use case in Swift Testing, but not to the PR directly: #69146#69147#71112
Resolves rdar://134278607.
The current implementation creates a non-natural loop and none of the SIL and
LLVM loop passes will work for such loops. We have to find a way to fix this in
SIL. Until then, rewrite so we get a natural loop in SIL.
During the toolchain build, when building the Swift standard library for
platforms other than macOS the `libclang_rt.a` needs to be copied out of the
host SDK. That wasn't happening for visionOS.
Resolves rdar://135023111.
Hi, I fixed several typos in Dictionary.swift file(#Line: 347, 1194).
- origin comments
```swift
// #347
// Prints "The 'star' image is a glyph.")
// #1194
// Prints "No value found for that key.""
```
- changed comments
```swift
// #347
// Prints "The 'star' image is a glyph.") // I thought the ' ) ' character was unnecessary, so I removed it.
// #1194
// Prints "No value found for that key."" // I thought the ' " ' character was unnecessary, so I removed it.
```
In the standard library shipped in Apple's SDKs and OSes, the implementation of
`_stdlib_isOSVersionAtLeast()` has diverged in order to solve some tricky
issues related to supporting iOS applications running on macOS. It's now time
to bring that change upstream in order to unblock further changes that depend
on it.
Originally introduced to resolve rdar://83378814.
Annotate all of the `Unsafe*` types and `unsafe` functions in the standard
library (including concurrency, synchronization, etc.) as `@unsafe`. Add a
few tests to ensure that we detect uses of these types in clients that
have disabled unsafe code.