Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async let + sending doesn't seem to work #76727

Open
mattmassicotte opened this issue Sep 26, 2024 · 0 comments
Open

async let + sending doesn't seem to work #76727

mattmassicotte opened this issue Sep 26, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@mattmassicotte
Copy link
Contributor

Description

I was trying to get around returning a non-Sendable type from a synchronous function. I thought I'd be able to use sending to deal with this, but it doesn't seem to work.

Reproduction

class NonSendable {}

@MainActor
func f() async {
	async let x = g()
	// error: non-sendable type 'NonSendable' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary
	_ = await x
}

func g() -> sending NonSendable {
	NonSendable()
}

await f()

Expected behavior

I would expect this to compile warning-free.

Environment

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.11 clang-1600.0.26.2)
Target: arm64-apple-macosx14.0

Additional information

No response

@mattmassicotte mattmassicotte added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant