CosmWasm / cosmwasm

Framework for building smart contracts in Wasm for the Cosmos SDK
https://www.cosmwasm.com/
Apache License 2.0
1.07k stars 336 forks source link

`QueryMsg` with type params and a default type fails to compile #1504

Closed uint closed 1 year ago

uint commented 1 year ago

We got a report that a QueryMsg enum with a type parameter and a default value causes trouble since 1.1.6.

#[cw_serde]
#[derive(QueryResponses)]
pub enum VaultStandardQueryMsg<T = ExtensionQueryMsg>
where
    T: JsonSchema,
{
...
}
defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
`#[deny(invalid_type_param_default)]` on by default
this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>

This is a regression due to how type parameters are copied from the type declaration to the generated impl QueryResponses block.

It's probably a good idea to fix this, release 1.1.7 and then yank 1.1.6.

webmaster128 commented 1 year ago

Done in https://github.com/CosmWasm/cosmwasm/pull/1505 and released as part of 1.1.8