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

Unexpected exclusivity violation for trivial ~Copyable struct #71045

Open
MaxDesiatov opened this issue Jan 21, 2024 · 0 comments
Open

Unexpected exclusivity violation for trivial ~Copyable struct #71045

MaxDesiatov opened this issue Jan 21, 2024 · 0 comments
Labels
access exclusivity Feature: Enforcement of exclusive access to memory bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. noncopyable struct/enum Feature → declarations: Noncopyable value type declarations

Comments

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Jan 21, 2024

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

@MaxDesiatov MaxDesiatov added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. access exclusivity Feature: Enforcement of exclusive access to memory noncopyable struct/enum Feature → declarations: Noncopyable value type declarations labels Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
access exclusivity Feature: Enforcement of exclusive access to memory bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. noncopyable struct/enum Feature → declarations: Noncopyable value type declarations
Projects
None yet
Development

No branches or pull requests

1 participant