Skip to content

Remove Future Sync bound from ServiceBuilder::boxed_clone_sync()#851

Merged
jplatte merged 3 commits intotower-rs:masterfrom
garypen:loosen-boxed-clone-sync
Feb 12, 2026
Merged

Remove Future Sync bound from ServiceBuilder::boxed_clone_sync()#851
jplatte merged 3 commits intotower-rs:masterfrom
garypen:loosen-boxed-clone-sync

Conversation

@garypen
Copy link
Contributor

@garypen garypen commented Feb 4, 2026

The function Future bounds are slightly too restrictive. Namely:

<L::Service as Service<R>>::Future: Send + Sync + 'static,

The BoxCloneSyncService and BoxCloneSyncServiceLayer require:

S::Future: Send + 'static,
<L::Service as Service<T>>::Future: Send + 'static,

Removing the Sync bound from the helper function:

  • Makes the helper function more useful (where futures are not Sync)
  • Is backwards compatible (loosening trait bound)

The function Future bounds are slightly too restrictive. Namely:
```
<L::Service as Service<R>>::Future: Send + Sync + 'static,
```

The `BoxCloneSyncService` and `BoxCloneSyncServiceLayer` require:
```
S::Future: Send + 'static,
<L::Service as Service<T>>::Future: Send + 'static,
```

Removing the `Sync` bound from the helper function:
 - Makes the helper function more useful (where futures are not `Sync`)
 - Is backwards compatible (loosening trait bound)
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Mind adding a changelog entry? You can put a new Unreleased heading / section before the latest release.

@jplatte jplatte merged commit 8358ee7 into tower-rs:master Feb 12, 2026
14 checks passed
@garypen garypen deleted the loosen-boxed-clone-sync branch February 12, 2026 08:30
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