Skip to content

Macro error on compiling code #20191

Closed as duplicate of#20153
Closed as duplicate of#20153
@redsun82

Description

@redsun82

On this snippet (and many others in the same crate, after opening in VSCode the contracts/ibc-reflect crate from https://github.com/CosmWasm/cosmwasm (that crate is excluded from the root workspace so it won't get indexed when the repo is opened from the root), rust-analyzer presents a macro error:

Image

This is the code:

#[cw_serde]
pub enum ExecuteMsg {
    AsyncAck {
        /// Existing channel where the packet was received
        channel_id: String,
        /// Sequence number of the packet that was received
        packet_sequence: Uint64,
        /// The acknowledgement to send back
        ack: IbcAcknowledgement,
    },
}

and this is what expanding recursively the macro gives:

// Recursive expansion of cw_serde macro
// ======================================

#[derive(
    ::cosmwasm_schema::serde::Serialize,
    ::cosmwasm_schema::serde::Deserialize,
    ::std::clone::Clone,
    ::std::fmt::Debug,
    ::std::cmp::PartialEq,
    ::cosmwasm_schema::schemars::JsonSchema,
    ::cosmwasm_schema::cw_schema::Schemaifier,
)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[serde(crate = ":: cosmwasm_schema::serde")]
#[schemaifier(crate = ":: cosmwasm_schema::cw_schema")]
#[schemars(crate = ":: cosmwasm_schema::schemars")]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    AsyncAck {
        #[doc = " Existing channel where the packet was received"]
        channel_id: String,
        #[doc = " Sequence number of the packet that was received"]
        packet_sequence: Uint64,
        #[doc = " The acknowledgement to send back"]
        ack: IbcAcknowledgement,
    },
}

(seems like it doesn't go further on the schemaifier/schemars macros).

I may try to make a minimal reproduction of this later, but I might not have the time to do it any time soon.

rust-analyzer version: 0.3.2527-standalone

rustc version: rustc 1.88.0 (6b00bc388 2025-06-23)

editor or extension: VSCode 0.3.2527
relevant settings: -
repository link (if public, optional): https://github.com/CosmWasm/cosmwasm
code snippet to reproduce: https://github.com/CosmWasm/cosmwasm/blob/da905f21598052bcae26aec82763054b699bf618/contracts/ibc-reflect/src/msg.rs#L10-L20

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions