Skip to content

Commit 373a97f

Browse files
authored
Merge pull request #635 from stzn/remove-sendable
[Concurrency, Protocols]~Sendableの記述を削除
2 parents 2a02ea0 + 41268b4 commit 373a97f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

language-guide/concurrency.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 並行処理\(Concurrency\)
22

3-
最終更新日: 2025/05/31
3+
最終更新日: 2025/06/28
44
原文: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html
55

66
非同期操作を行う。
@@ -497,12 +497,15 @@ struct TemperatureReading {
497497
}
498498
```
499499

500-
`Sendable` プロトコルへの暗黙の準拠を上書きするには、`~Sendable` と書きます:
500+
`Sendable` プロトコルへの暗黙の準拠を上書きするには、`Sendable` への unavailable 準拠を書きます:
501501

502502
```swift
503-
struct FileDescriptor: ~Sendable {
503+
struct FileDescriptor {
504504
let rawValue: Int
505505
}
506+
507+
@available(*, unavailable)
508+
extension FileDescriptor: Sendable {}
506509
```
507510

508-
プロトコルへの暗黙の準拠を抑制する詳細な情報は、[暗黙の制約\(Implicit Constraints\)](./generics.md#暗黙の制約implicit-constraints) を参照ください
511+
unavailable 準拠を使用して、[プロトコルへの暗黙の準拠\(Implicit Conformance to a Protocol\)](./protocols.md#プロトコルへの暗黙の準拠implicit-conformance-to-a-protocol)で説明されているように、プロトコルに対する暗黙的な準拠を抑制することもできます

language-guide/protocols.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# プロトコル\(Protocols\)
22

3-
最終更新日: 2025/5/24
3+
最終更新日: 2025/6/28
44
原文: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html
55

66
準拠型が実装する必要がある要件を定義する。
@@ -560,7 +560,7 @@ struct FileDescriptor: ~Sendable {
560560

561561
```swift
562562
@available(*, unavailable)
563-
extension FileDescriptor Sendable { }
563+
extension FileDescriptor: Sendable { }
564564
```
565565

566566
前の例のように、コードのある場所で `~Sendable` と記述した場合でも、プログラムの他の場所のコードは `FileDescriptor` 型を拡張して `Sendable` 準拠を追加できます。対照的に、この例の `unavailable` extension は、`Sendable` への暗黙的な準拠を抑制し、さらにコードの他の場所にある extension がその型に `Sendable` 準拠を追加するのを防ぎます。

0 commit comments

Comments
 (0)