Skip to content

Borrowing protocol method with consuming implementation results in "Copy of noncopyable typed value" #82261

Open
@Arden144

Description

@Arden144

Description

Conforming a noncopyable struct to a noncopyable protocol that requires a borrowing method with one that is consuming instead results in a compiler error asking to report the bug.

Reproduction

protocol Foo: ~Copyable {
    borrowing func foo()
}

struct Bar: ~Copyable, Foo {
    // Copy of noncopyable typed value. This is a compiler bug. Please file a bug with a small example of the bug
    consuming func foo() {}
}

Expected behavior

A more specific error is reported due to the mismatch in the protocol conformance.

Environment

$ swiftc --version
swift-driver version: 1.127.4.2 Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
Target: arm64-apple-macosx15.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions