Skip to content

Cannot build with default features (disabling macros) #625

@howardjohn

Description

@howardjohn

Describe the bug
Cannot build without macros feature

To Reproduce

cargo init f
cd f
cargo add rmcp --no-default-features -F server
cargo check
error[E0433]: failed to resolve: could not find `schemars` in the crate root
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/handler/server/common.rs:8:36
    |
  8 |     RoleServer, model::JsonObject, schemars::generate::SchemaSettings, service::RequestContext,
    |                                    ^^^^^^^^ could not find `schemars` in the crate root
    |
note: found an item that was configured out
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/lib.rs:183:9
    |
181 | #[cfg(all(feature = "macros", feature = "server"))]
    |           ------------------ the item is gated behind the `macros` feature
182 | #[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
183 | pub use schemars;
    |         ^^^^^^^^

error[E0432]: unresolved import `pastey`
 --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:3:5
  |
3 | use pastey::paste;
  |     ^^^^^^ use of unresolved module or unlinked crate `pastey`
  |
  = help: if you wanted to use a crate named `pastey`, use `cargo add pastey` to add it to your `Cargo.toml`

error[E0412]: cannot find type `ServerCapabilitiesBuilder` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:255:5
    |
120 | pub struct ServerCapabilities {
    | ----------------------------- similarly named struct `ServerCapabilities` defined here
...
255 |     ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, R, true, TASKS>>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `ServerCapabilities`

error[E0412]: cannot find type `ServerCapabilitiesBuilderState` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:255:31
    |
255 |     ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, R, true, TASKS>>
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `ServerCapabilitiesBuilder` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:266:5
    |
120 | pub struct ServerCapabilities {
    | ----------------------------- similarly named struct `ServerCapabilities` defined here
...
266 |     ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, true, R, T, TASKS>>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `ServerCapabilities`

error[E0412]: cannot find type `ServerCapabilitiesBuilderState` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:266:31
    |
266 |     ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, true, R, T, TASKS>>
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `ServerCapabilitiesBuilder` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:277:5
    |
120 | pub struct ServerCapabilities {
    | ----------------------------- similarly named struct `ServerCapabilities` defined here
...
277 |     ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, true, T, TASKS>>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `ServerCapabilities`

error[E0412]: cannot find type `ServerCapabilitiesBuilderState` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:277:31
    |
277 |     ServerCapabilitiesBuilder<ServerCapabilitiesBuilderState<E, L, C, P, true, T, TASKS>>
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `ClientCapabilitiesBuilder` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:305:5
    |
 90 | pub struct ClientCapabilities {
    | ----------------------------- similarly named struct `ClientCapabilities` defined here
...
305 |     ClientCapabilitiesBuilder<ClientCapabilitiesBuilderState<E, true, S, EL, TASKS>>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `ClientCapabilities`

error[E0412]: cannot find type `ClientCapabilitiesBuilderState` in this scope
   --> /home/john/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.13.0/src/model/capabilities.rs:305:31
    |
305 |     ClientCapabilitiesBuilder<ClientCapabilitiesBuilderState<E, true, S, EL, TASKS>>
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

Some errors have detailed explanations: E0412, E0432, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `rmcp` (lib) due to 10 previous errors

Expected behavior
Macro is optional

Logs
If applicable, add logs to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions