Skip to content

Commit 7e05f31

Browse files
authored
Match code listing for nonsendable example (#228)
The code listing changed in c554b62 but the old example got left behind in the prose and swifttest block. Fixes: swiftlang/swift-book#224
2 parents 8022a41 + d3d9bc3 commit 7e05f31

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

TSPL.docc/LanguageGuide/Concurrency.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,23 +1335,23 @@ a file descriptor isn't safe to send across concurrency domains.
13351335
<!--
13361336
- test: `suppressing-implied-sendable-conformance`
13371337
1338-
-> struct NonsendableTemperatureReading {
1339-
-> var measurement: Int
1338+
-> struct FileDescriptor {
1339+
-> let rawValue: CInt
13401340
-> }
13411341
---
13421342
-> @available(*, unavailable)
1343-
-> extension NonsendableTemperatureReading: Sendable { }
1344-
>> let nonsendable: Sendable = NonsendableTemperatureReading(measurement: 10)
1345-
!$ warning: conformance of 'NonsendableTemperatureReading' to 'Sendable' is unavailable; this is an error in Swift 6
1346-
!! let nonsendable: Sendable = NonsendableTemperatureReading(measurement: 10)
1343+
-> extension FileDescriptor: Sendable { }
1344+
>> let nonsendable: Sendable = FileDescriptor(rawValue: 10)
1345+
!$ warning: conformance of 'FileDescriptor' to 'Sendable' is unavailable; this is an error in Swift 6
1346+
!! let nonsendable: Sendable = FileDescriptor(rawValue: 10)
13471347
!! ^
1348-
!$ note: conformance of 'NonsendableTemperatureReading' to 'Sendable' has been explicitly marked unavailable here
1349-
!! extension NonsendableTemperatureReading: Sendable { }
1348+
!$ note: conformance of 'FileDescriptor' to 'Sendable' has been explicitly marked unavailable here
1349+
!! extension FileDescriptor: Sendable { }
13501350
!! ^
13511351
-->
13521352

13531353
In the code above,
1354-
the `NonsendableTemperatureReading` is a structure
1354+
the `FileDescriptor` is a structure
13551355
that meets the criteria to be implicitly sendable.
13561356
However, the extension makes its conformance to `Sendable` unavailable,
13571357
preventing the type from being sendable.

0 commit comments

Comments
 (0)