Skip to content

Remove unnecessary Send + Sync bounds from Redaction#874

Merged
max-sixty merged 1 commit intomitsuhiko:masterfrom
max-sixty:review-rc
Feb 5, 2026
Merged

Remove unnecessary Send + Sync bounds from Redaction#874
max-sixty merged 1 commit intomitsuhiko:masterfrom
max-sixty:review-rc

Conversation

@max-sixty
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #873 ("Don't use Arc in Settings unnecessarily").

  • Remove Send + Sync bounds from Redaction::Dynamic variant
  • Remove Send + Sync bounds from dynamic_redaction() function
  • Remove Send + Sync bounds from Settings::add_dynamic_redaction() method

Since Settings are stored in thread-local storage and wrapped in Rc, they can never cross thread boundaries. The Send + Sync bounds were vestigial from when Arc was used for DEFAULT_SETTINGS.

This relaxes the API to allow non-Send closures in dynamic redactions, which is now safe since those closures can never be sent to another thread.

Test plan

  • All tests pass with cargo test --all-features
  • No clippy warnings

🤖 Generated with Claude Code

Follow-up to f680868 ("Don't use `Arc` in `Settings` unnecessarily").

Since `Settings` are stored in thread-local storage and wrapped in `Rc`,
they can never cross thread boundaries. The `Send + Sync` bounds on
`Redaction::Dynamic` and related functions were vestigial from when
`Arc` was used for `DEFAULT_SETTINGS`.

This relaxes the API to allow non-`Send` closures in dynamic redactions,
which is now safe since those closures can never be sent to another thread.

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit eaf15ba into mitsuhiko:master Feb 5, 2026
15 checks passed
@max-sixty max-sixty mentioned this pull request Mar 27, 2026
max-sixty added a commit that referenced this pull request Mar 27, 2026
## Summary

- Bump version to 1.47.0
- Update CHANGELOG

### Changes included in this release

- Add `Comparator` trait for customizing how snapshot values are
compared. #872 (@dstu)
- Sort sequences in `sort_maps` to fix non-deterministic `HashSet`
snapshots. #876
- Improve TOML serialization error message for unsupported types. #880
- Remove unnecessary `Send + Sync` bounds from `Redaction`, allowing
non-`Send` closures in dynamic redactions. #874
- Don't use `Arc` in `Settings` unnecessarily. #873 (@dstu)
- Upgrade `console` to 0.16 and MSRV to 1.66. #885
- Upgrade `toml-edit` to 0.25. #882 (@alexanderkjall)

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude <noreply@anthropic.com>
max-sixty added a commit to max-sixty/insta that referenced this pull request Mar 30, 2026
The Arc→Rc change (mitsuhiko#873) and Send+Sync removal (mitsuhiko#874) were
semver-breaking — they removed auto-trait impls from Settings,
Redactions, Redaction, and SettingsBindDropGuard. This broke
downstream crates like cedar-policy that depend on Send + Sync.

Reverts to Arc and restores Send + Sync bounds on Redaction and
dynamic_redaction(). Adds Send + Sync to the Comparator trait
(new in 1.47.0) for compatibility. Adds a compile-time assertion
to prevent future regressions.

TODOs mark these as candidates for Rc in the next breaking change.

Co-Authored-By: Claude <noreply@anthropic.com>
max-sixty added a commit that referenced this pull request Mar 30, 2026
The Arc→Rc change (#873) and Send+Sync removal (#874) were
semver-breaking — they removed auto-trait impls from `Settings`,
`Redactions`, `Redaction`, and `SettingsBindDropGuard`. This broke
downstream crates like
[cedar-policy](cedar-policy/cedar-spec#917)
that depend on `Send + Sync`.

This reverts to `Arc` and restores `Send + Sync` bounds on `Redaction`
and `dynamic_redaction()`. Also adds `Send + Sync` to the `Comparator`
trait (new in 1.47.0) since `Arc<ActualSettings>` requires it. A
compile-time assertion prevents future regressions.

TODOs mark the `Arc` usage and `Comparator` bounds as candidates for
removal in the next breaking change.

Thanks to @john-h-kastner-aws for reporting in #873 (comment).

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <noreply@anthropic.com>
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