Skip to content

[Concurrency] Improve the diagnostics for unsafe immutable global and static variables. #72147

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

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

hborla
Copy link
Member

@hborla hborla commented Mar 7, 2024

The current diagnostic is a little hard to mentally parse, and folks seem to be confused specifically when the global variable is a let constant. This changes the diagnostic to state that the non-Sendable type may have shared mutable state, and moves the potential resolutions to an attached note.

@hborla
Copy link
Member Author

hborla commented Mar 7, 2024

@swift-ci please smoke test

.warnUntilSwiftVersion(6);
diagVar->diagnose(diag::shared_immutable_state_decl_note,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking merging: worth a fixme to add Sendable? 🤔

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reads definitely simpler, lgtm :)

@hborla hborla merged commit b06fb74 into swiftlang:main Mar 7, 2024
@hborla hborla deleted the global-concurrency-diagnostics branch March 7, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants