Skip to content

Commit 1a0b13a

Browse files
committed
[stdlib] Add a non-failable initializer
1 parent b67e85d commit 1a0b13a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

stdlib/public/Distributed/DistributedActor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2020 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2020 - 2023 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -290,7 +290,7 @@ extension CodingUserInfoKey {
290290
/// Forgetting to set this key will result in that initializer throwing, because
291291
/// an actor system is required in order to call ``DistributedActor/resolve(id:using:)`` using it.
292292
@available(SwiftStdlib 5.7, *)
293-
public static let actorSystemKey = CodingUserInfoKey(rawValue: "$distributed_actor_system")!
293+
public static let actorSystemKey = CodingUserInfoKey("$distributed_actor_system")
294294
}
295295

296296
@available(SwiftStdlib 5.7, *)

stdlib/public/core/Codable.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,6 +3137,14 @@ public struct CodingUserInfoKey: RawRepresentable, Equatable, Hashable, Sendable
31373137
self.rawValue = rawValue
31383138
}
31393139

3140+
/// Creates a new instance with the given raw value.
3141+
///
3142+
/// - parameter rawValue: The value of the key.
3143+
@_alwaysEmitIntoClient
3144+
public init(_ rawValue: String) {
3145+
self.init(rawValue: rawValue)!
3146+
}
3147+
31403148
/// Returns a Boolean value indicating whether the given keys are equal.
31413149
///
31423150
/// - parameter lhs: The key to compare against.

0 commit comments

Comments
 (0)