Skip to content

Copy of noncopyable typed value #80724

Open
@iDmitriyy

Description

@iDmitriyy

Description

Using of ~Copyable type with async let causes compiler error

Reproduction

    struct NonCopyable: ~Copyable {}

    struct Pair: ~Copyable {
      let first: NonCopyable
      let second: NonCopyable
    }
    
    @Sendable func request() async -> NonCopyable { NonCopyable() }
    
    async let first = request()
    async let second = request()
    
    let outputs = await Pair(first: first, second: second) // ERROR: Copy of noncopyable typed value. This is a compiler bug. Please file a bug with a small example of the bug

Expected behavior

Compiler don't ask me to file a bug.

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

XCode 16.3

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    async & awaitFeature → concurrency: asynchronous function aka the async/await patternbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresnoncopyable struct/enumFeature → declarations: Noncopyable value type declarations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions