# DocC omits @Sendable. Bug or intentional?

**URL:** <https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307>\
**Category:** Swift-DocC\
**Tags:** documentation, sendable, docc\
**Created:** [September 23, 2025, 12:31pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307 "2025-09-23T12:31:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ole](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ole/32/18720_2.png) [@ole](https://forums.swift.org/u/ole)\
**Post date:** [September 23, 2025, 12:31pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/1 "2025-09-23T12:31:44Z")

</div>

I recently posted an issue in swiftlang/swift about a missing `@Sendable` annotation in the documentation for [`AsyncStream(unfolding:onCancel:)`](https://developer.apple.com/documentation/swift/asyncstream/init(unfolding:oncancel:)):

> <https://github.com/swiftlang/swift/issues/84202>
>
> \### Description
> 
> In 2024-03 \`@Sendable\` was added to some closure parameters for… \`Async\[Throwing\]Stream.init(unfolding:)\`. Relevant PR from @hborla: \[\[Concurrency\] Add a few missing Sendable annotations in the concurrency library\](https://github.com/swiftlang/swift/pull/72252)
> 
> As of 2025-09-10, this fact is not reflected in the documentation, i.e. the \`@Sendable\` requirements are missing:
> 
> https://developer.apple.com/documentation/swift/asyncstream/init(unfolding:oncancel:):
> 
> \> \`\`\`swift
> \> @preconcurrency
> \> init(
> \> unfolding produce: @escaping () async -\> Element?,
> \> onCancel: (() -\> Void
> \> )
> \> \`\`\`
> 
> https://developer.apple.com/documentation/swift/asyncthrowingstream/init(unfolding:):
> 
> \> \`\`\`swift
> \> @preconcurrency
> \> init(unfolding produce: @escaping () async throws -\> Element?) where Failure == any Error
> \> \`\`\`
> 
> I don't think the missing \`@Sendable\` annotations are directly related to the fact that the \`@Sendable\` annotations were added later. The \`onCancel:\` param was \`@Sendable\` from the beginning, but the documentation doesn't reflect this either.
> 
> But I'm wondering if this issue is related to the \`@preconcurrency\` annotation on these APIs (which I understand is a side effect of the change in the above PR)? Do \`@preconcurrency\` APIs hide any concurrency-related attributes in their docs?
> 
> \### Reproduction
> 
> n/a
> 
> \### Expected behavior
> 
> n/a
> 
> \### Environment
> 
> Documentation page at https://developer.apple.com/documentation/swift/asyncstream/init(unfolding:oncancel:) as of 2025-09-10. This is a few days before the formal release of Swift 6.2, so it's possible the documentation will be updated then? But I doubt it, given the relevant change was made 18 months ago.
> 
> \### Additional information
> 
> \_No response\_

Social media replies from @beccadax and @ktoso (also quoted in the issue) pointed me to the possibility that this could be a more general issue and that `@Sendable` attributes are generally omitted in DocC-rendered documentation.

So I created a simple test package to verify this:

> **[GitHub - ole/DocC-omits-at-Sendable: Swift’s DocC documentation compiler omits...](https://github.com/ole/DocC-omits-at-Sendable)**
>
> Swift’s DocC documentation compiler omits \`@Sendable\` attributes in the generated documentation (as of Swift 6.2).

And indeed, DocC doesn't seem to render any `@Sendable` attributes, despite them being in the source code (tested with swift-docc-plugin v1.4.5, Swift 6.2, macOS 15.6.1). For example, this is the declaration in the source code:

```swift
struct StructWithSendable {
    public func doSomething(_ body: @Sendable () -> Void) {}
}

```

And DocC renders it like this:

```swift
func doSomething(_ body: () -> Void)

```

 ![DocC-omits-@Sendable](https://global.discourse-cdn.com/swift/original/3X/1/e/1e2293a27d6213885da09ee28131335d1d54974b.png)

Questions:

- Is this intended behavior?
- If it is intended, what's the reason?

---

<div class="post-metadata">

**Author:** ![Kyle-Ye](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kyle-ye/32/19686_2.png) [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Post date:** [September 23, 2025, 1:07pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/2 "2025-09-23T13:07:13Z")

</div>

> - Is this intended behavior?

No. Don't think its the intended behavior IMO.

You can first confirm that `@Sendable` is emitted into the symbol graph file. If not, we need some change into the Swift compiler (File a GH issue to swiftlang/swift). cc @QuietMisdreavus

If `@Sendable` is emitted into symbol graph, then it's probably DocC not consuming it somehow. (File a issue on swift-docc or swift-docc-symbolkit)

---

<div class="post-metadata">

**Author:** ![Joseph\_Heck](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joseph_heck/32/22369_2.png) [@Joseph\_Heck](https://forums.swift.org/u/Joseph_Heck)\
**Post date:** [September 23, 2025, 11:04pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/3 "2025-09-23T23:04:50Z")

</div>

I'm sure you were just dying to see a bit of a raw symbol graph in the forums, so - taking from Ole's example, this is the function signature that's generated by a symbol graph for the `doSomething` method, which is - if it existed, I thought I might find the `Sendable` detail about the parameter.

```json
"functionSignature": {
  "parameters": [
    {
      "name": "body",
      "declarationFragments": [
        {
          "kind": "identifier",
          "spelling": "body"
        },
        {
          "kind": "text",
          "spelling": ": () -> "
        },
        {
          "kind": "typeIdentifier",
          "spelling": "Void",
          "preciseIdentifier": "s:s4Voida"
        }
      ]
    }
  ],
  "returns": [
    {
      "kind": "text",
      "spelling": "()"
    }
  ]
},

```

(I used the command `swift package dump-symbol-graph` to get the detail, and took a snippet of the resulting file)

I made another quick variation that included `@escaping` in a similar method, and it also doesn't show in the parameters list, but it _does_ get listed with the list of `declarationFragments`. For the Ole's original example, that output today is:

```json
"declarationFragments": [
        {
          "kind": "keyword",
          "spelling": "func"
        },
        {
          "kind": "text",
          "spelling": " "
        },
        {
          "kind": "identifier",
          "spelling": "doSomething"
        },
        {
          "kind": "text",
          "spelling": "("
        },
        {
          "kind": "externalParam",
          "spelling": "_"
        },
        {
          "kind": "text",
          "spelling": " "
        },
        {
          "kind": "internalParam",
          "spelling": "body"
        },
        {
          "kind": "text",
          "spelling": ": () -> "
        },
        {
          "kind": "typeIdentifier",
          "spelling": "Void",
          "preciseIdentifier": "s:s4Voida"
        },
        {
          "kind": "text",
          "spelling": ")"
        }
],

```

So I think the fundamental issue is that Sendable isn't included in that list as an attribute.

Instead of the following entry from the above list:

```json
        {
          "kind": "text",
          "spelling": ": () -> "
        },

```

I'd think to see something like:

```json
       {
          "kind": "text",
          "spelling": ": "
        },
        {
          "kind": "attribute",
          "spelling": "@Sendable "
        },
        {
          "kind": "text",
          "spelling": "() -> "
        },

```

Which I think would reflect the @Sendable attribute into the resulting documentation content.

/cc @QuietMisdreavus, who's far more familiar with symbol graphs than I.

In short, it looks like the SymbolGraph returned from the compiler isn't providing the detail needed to expose it in DocC at the moment.

---

<div class="post-metadata">

**Author:** ![dima\_kozhinov](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dima\_kozhinov](https://forums.swift.org/u/dima_kozhinov)\
**Post date:** [September 24, 2025, 12:22am UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/4 "2025-09-24T00:22:54Z")

</div>

Also the `public` declaration was lost in Ole's example. I think documentation should reflect access level.

---

<div class="post-metadata">

**Author:** ![ole](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ole/32/18720_2.png) [@ole](https://forums.swift.org/u/ole)\
**Post date:** [September 24, 2025, 11:33am UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/5 "2025-09-24T11:33:06Z")

</div>

> [@Joseph\_Heck](#):
>
> So I think the fundamental issue is that Sendable isn't included in that list as an attribute.
> 
> […]
> 
> In short, it looks like the SymbolGraph returned from the compiler isn't providing the detail needed to expose it in DocC at the moment.

Thank you so much for doing the analysis, Joseph! I didn't even know `swift package dump-symbol-graph` existed.

---

<div class="post-metadata">

**Author:** ![Joseph\_Heck](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joseph_heck/32/22369_2.png) [@Joseph\_Heck](https://forums.swift.org/u/Joseph_Heck)\
**Post date:** [September 24, 2025, 5:00pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/6 "2025-09-24T17:00:48Z")

</div>

The default display for symbols when publishing docs for a library is the public access level, so for the common case, that's assumed rather than repeated in every entry. When you're generating a documentation archive for your own content, you can control what visibility level is included, and that information (the access level for the symbol) _is_ included in the symbol graph.

---

<div class="post-metadata">

**Author:** ![Joseph\_Heck](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joseph_heck/32/22369_2.png) [@Joseph\_Heck](https://forums.swift.org/u/Joseph_Heck)\
**Post date:** [November 18, 2025, 12:34am UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/7 "2025-11-18T00:34:41Z")

</div>

I've been meaning to follow up on this and lost track for a bit, but opened a bug for this: [DocC omits @Sendable annotations on parameter options in methods · Issue #1358 · swiftlang/swift-docc · GitHub](https://github.com/swiftlang/swift-docc/issues/1358)

I'm reasonably confident the fix for this needs to be in the Swift compiler itself - where the AST fragments are generated/printed into symbol graphs that DocC uses, and that it was just missed along the way earlier.

---

<div class="post-metadata">

**Author:** ![Slava\_Pestov](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/slava_pestov/32/30204_2.png) [@Slava\_Pestov](https://forums.swift.org/u/Slava_Pestov)\
**Post date:** [November 18, 2025, 1:05pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/8 "2025-11-18T13:05:18Z")

</div>

> [@Joseph\_Heck](#):
>
> I've been meaning to follow up on this and lost track for a bit, but opened a bug for this: [DocC omits @Sendable annotations on parameter options in methods · Issue #1358 · swiftlang/swift-docc · GitHub](https://github.com/swiftlang/swift-docc/issues/1358)

It’s just the issue title, but bear in mind that unlike `@autoclosure` for example, `@Sendable` is not a parameter option, because it can appear anywhere within a type, for example `func f(_: Array<@Sendable () -> ()>)`.

---

<div class="post-metadata">

**Author:** ![ole](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ole/32/18720_2.png) [@ole](https://forums.swift.org/u/ole)\
**Post date:** [November 19, 2025, 8:20am UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/9 "2025-11-19T08:20:03Z")

</div>

> [@](#):
>
> I've been meaning to follow up on this and lost track for a bit, but opened a bug for this: [DocC omits @Sendable annotations on parameter options in methods · Issue #1358 · swiftlang/swift-docc · GitHub](https://github.com/swiftlang/swift-docc/issues/1358)

Thank you @Joseph_Heck!

---

<div class="post-metadata">

**Author:** ![ole](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ole/32/18720_2.png) [@ole](https://forums.swift.org/u/ole)\
**Post date:** [April 7, 2026, 12:50pm UTC](https://forums.swift.org/t/docc-omits-sendable-bug-or-intentional/82307/10 "2026-04-07T12:50:51Z")

</div>

Update: this has been fixed. For reference:

- [[SymbolGraphGen] add Sendable to the allowed attributes in declaration fragments by QuietMisdreavus · Pull Request #80465 · swiftlang/swift · GitHub](https://github.com/swiftlang/swift/pull/80465)
- [DocC fails to omit @Sendable annotations in methods · Issue #1358 · swiftlang/swift-docc · GitHub](https://github.com/swiftlang/swift-docc/issues/1358)
- [Documentation: AsyncStream(unfolding:onCancel:) closures must be @Sendable but docs don't show this · Issue #84202 · swiftlang/swift · GitHub](https://github.com/swiftlang/swift/issues/84202)
