Skip to content

Add immutable_account_mutated dylint detector#40

Merged
maxkup19 merged 4 commits into
mainfrom
dylint/immutabel-account-mutated
Mar 15, 2026
Merged

Add immutable_account_mutated dylint detector#40
maxkup19 merged 4 commits into
mainfrom
dylint/immutabel-account-mutated

Conversation

@maxkup19

Copy link
Copy Markdown
Contributor

Summary

  • Implement immutable_account_mutated as a dylint detector (extension/detectors/immutable_account_mutated/) using LateLintPass HIR analysis
  • Remove the built-in syn-based ImmutableAccountMutatedDetector from the language server registry (replaced by the dylint version)
  • Add DiagnosticRelatedInformation support to the dylint diagnostic pipeline — detectors can now emit bidirectional navigation links (e.g., mutation site ↔ field declaration)
  • Clean up dead code across the language server (unused loader, cache methods, compiler helpers, anchor pattern utilities)

Detection strategy

The lint checks public functions with Context<T> parameters, resolves the Accounts struct T, identifies fields of type Account/AccountInfo/AccountLoader without #[account(mut)] or #[account(init)], and walks the function body for mutations (assignments, compound assignments, &mut borrows, mutating method calls). Emits warnings on both the mutation site and the field declaration with clickable cross-references.

@maxkup19
maxkup19 merged commit 1f7e974 into main Mar 15, 2026
2 checks passed
@maxkup19
maxkup19 deleted the dylint/immutabel-account-mutated branch March 15, 2026 22:03
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.

1 participant