Skip to content

Unexpected exclusivity violation for trivial ~Copyable struct #71045

Open
@MaxDesiatov

Description

@MaxDesiatov

Description

When building this sample code, I'm getting this error message

Repro.swift:2:7: error: 'arena' has an unexpected exclusivity violation. This is a compiler bug.
Please file a bug with a small example of the bug

Reproduction

func modify() {
  var arena = Arena()
  arena.modify { $0 += 1 }
}

private struct Arena: ~Copyable {
  func modify(modifier: (inout Int) throws -> ()) rethrows {
  }
}

Expected behavior

This code compiles or provides clear actionable diagnostic message.

Environment

swift-DEVELOPMENT-SNAPSHOT-2024-01-15-a-osx from https://swift.org/download

Apple Swift version 5.11-dev (LLVM e2b71339d3295a4, Swift 8ae3ee9)
Target: arm64-apple-macosx14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    access exclusivityFeature: Enforcement of exclusive access to memorybugA deviation from expected or documented behavior. Also: expected but undesirable behavior.noncopyable 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