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

Why can I mark a Sendable value sending #74616

Open
mattmassicotte opened this issue Jun 21, 2024 · 3 comments
Open

Why can I mark a Sendable value sending #74616

mattmassicotte opened this issue Jun 21, 2024 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features

Comments

@mattmassicotte
Copy link
Contributor

Description

It's possible this is expected, but it seems to me like maybe this should be a warning?

Reproduction

struct ThisIsSendable: Sendable {
}

// feels redundant, no?
func acceptStuff(_ value: sending ThisIsSendable) {
}

Expected behavior

I would expect a warning. The sending is redundant. And if something changed such that it became necessary, that would immeidately be surfaced within the function body as an error.

Environment

Apple Swift version 6.0-dev (LLVM 5f87d6ee2f8c800, Swift 5c01ca1)
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 Jun 21, 2024
@ktoso
Copy link
Contributor

ktoso commented Jun 24, 2024

That feels redundant indeed, sending a Sendable type doesn't really do anything to the Sendable type, it is free to be sent around freely after all.

@ktoso ktoso added concurrency Feature: umbrella label for concurrency language features and removed triage needed This issue needs more specific labels labels Jun 24, 2024
@hborla
Copy link
Member

hborla commented Jul 14, 2024

IMO this should result in a compiler warning that sending has no effect on a type conforming to Sendable

@Androp0v
Copy link

Can I get this assigned? I already opened a PR (#74849)

Androp0v added a commit to Androp0v/swift that referenced this issue Sep 2, 2024
…#74616)

When a function parameter is Sendable, adding 'sending' annotation does nothing, as the value is safe to be sent across isolation boundaries. SE-0430 seems to imply that 'sending' is intended to be used for non-Sendable types only.
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. concurrency Feature: umbrella label for concurrency language features
Projects
None yet
Development

No branches or pull requests

4 participants