Skip to content

Distributed: cannot use mutating member on immutable value, 'handler' is immutable #59159

Closed
@MaxDesiatov

Description

@MaxDesiatov

Describe the bug
When trying to implement a type conforming to DistributedActorSystem an inscrutable error message is shown, which makes reference to identifiers that aren't present in the code. It's unclear how to fix this error. This is the only error shown by the compiler when using swift build or building in Xcode:

<unknown>:0: error: cannot use mutating member on immutable value: 'handler' is immutable

Complete build log can be seen here: https://github.com/MaxDesiatov/ClientServerRPC/runs/6659508563?check_suite_focus=true

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/MaxDesiatov/ClientServerRPC
  2. Run swift build with latest 5.7 or trunk snapshot.

Expected behavior
Either the project builds or a clear actionable error message is presented.

Environment (please complete the following information):

  • OS: macOS 12.4 (21F79), but most likely reproducible on any platform that supports distributed actors.
  • Xcode Version/Tag/Branch: 13.4 (13F17a)
  • Toolchain: Swift Development Snapshot 2022-05-27, also reproducible with 5.7 Development Snapshot 2022-05-18 (a)

Additional context
Source code of the implementation is available at https://github.com/MaxDesiatov/ClientServerRPC/blob/6f50c1a/Sources/App/RPC/RPCSystem.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.distributedFeature → concurrency: distributed actor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions