Skip to content

fix: use cfg-gated Send+Sync supertraits to avoid semver break#757

Open
DaleSeo wants to merge 1 commit intomainfrom
fix/avoid-major-version-bump
Open

fix: use cfg-gated Send+Sync supertraits to avoid semver break#757
DaleSeo wants to merge 1 commit intomainfrom
fix/avoid-major-version-bump

Conversation

@DaleSeo
Copy link
Member

@DaleSeo DaleSeo commented Mar 17, 2026

Motivation and Context

PR #740 replaced Send + Sync supertraits on Service, DynService, and ServerHandler with a conditional MaybeSend trait for the local feature. This caused release-plz to treat it as a breaking change and propose a 2.0.0 bump in PR #747.

Without the local feature, the public API is unchanged as MaybeSend is equivalent to Send + Sync. This PR makes that more explicit by using cfg-gated trait definitions that keep the original Send + Sync supertraits when local is not enabled. A server_handler_methods!() macro shares the method bodies to avoid duplication.

How Has This Been Tested?

  • Before
❯ cargo semver-checks --package rmcp --default-features
    Building rmcp v1.2.0 (current)
       Built [   1.217s] (current)
     Parsing rmcp v1.2.0 (current)
      Parsed [   0.017s] (current)
     Parsing rmcp v1.2.0 (baseline, cached)
      Parsed [   0.017s] (baseline)
    Checking rmcp v1.2.0 -> v1.2.0 (no change; assume patch)
     Checked [   0.029s] 221 checks: 220 pass, 1 fail, 0 warn, 24 skip

--- failure trait_added_supertrait: non-sealed trait added new supertraits ---

Description:
A non-sealed trait added one or more supertraits, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#generic-bounds-tighten
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/trait_added_supertrait.ron

Failed in:
  trait rmcp::handler::server::ServerHandler gained MaybeSend in file /Users/dale.seo/dale/rust-sdk/crates/rmcp/src/handler/server.rs:169
  trait rmcp::ServerHandler gained MaybeSend in file /Users/dale.seo/dale/rust-sdk/crates/rmcp/src/handler/server.rs:169
  trait rmcp::service::DynService gained MaybeSend in file /Users/dale.seo/dale/rust-sdk/crates/rmcp/src/service.rs:204
  trait rmcp::service::Service gained MaybeSend in file /Users/dale.seo/dale/rust-sdk/crates/rmcp/src/service.rs:135
  trait rmcp::Service gained MaybeSend in file /Users/dale.seo/dale/rust-sdk/crates/rmcp/src/service.rs:135

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [   1.577s] rmcp
  • After
❯ cargo semver-checks --package rmcp --default-features
    Building rmcp v1.2.0 (current)
       Built [   2.125s] (current)
     Parsing rmcp v1.2.0 (current)
      Parsed [   0.017s] (current)
     Parsing rmcp v1.2.0 (baseline, cached)
      Parsed [   0.018s] (baseline)
    Checking rmcp v1.2.0 -> v1.2.0 (no change; assume patch)
     Checked [   0.031s] 221 checks: 221 pass, 24 skip
     Summary no semver update required
    Finished [   2.858s] rmcp

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@github-actions github-actions bot added T-core Core library changes T-handler Handler implementation changes labels Mar 17, 2026
@DaleSeo DaleSeo marked this pull request as ready for review March 17, 2026 15:47
@DaleSeo DaleSeo requested a review from a team as a code owner March 17, 2026 15:47
@DaleSeo DaleSeo self-assigned this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-handler Handler implementation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant