swift
5149dbcd - Lifetimes: Infer copy dependence kind on `@noescape` closures (#88879)

Commit
4 days ago
Lifetimes: Infer copy dependence kind on `@noescape` closures (#88879) Follow-up to https://github.com/swiftlang/swift/pull/88733, enabling the example in rdar://172511809 ([nonescapable] Allow a nonescaping function to be a lifetime dependency source): ```swift @_lifetime(body) // Inferred dependence kind: copy func foo(body: () -> Span<Int>) { body() } ``` or ```swift // Inferred: @_lifetime(copy body) func foo(body: () -> Span<Int>) { body() } ``` Follow-up: Consider also disallowing borrow dependence on `@noescape` closures. <!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! --> --------- Co-authored-by: Andrew Trick <atrick@apple.com>
Author
Parents
Loading