Skip to content

Initial Code does not compile: Let 'benchmarks' is not concurrency-safe because non-'Sendable' type '() -> Benchmark?' may have shared mutable state #339

@atacan

Description

@atacan

Steps

  • Added .package(url: "https://github.com/ordo-one/package-benchmark", .upToNextMajor(from: "1.4.0")), to Package.swift
  • Ran swift package --allow-writing-to-package-directory benchmark init MyNewBenchmarkTarget
  • It creates "MyNewBenchmarkTarget.swift" file with let benchmarks = { ... }
  • Compile the target MyNewBenchmarkTarget

Fix?

Replace let benchmarks = { ... } with func benchmarks() { ... }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions