From 842adde70890aabc9191c6c8c06ae6ad9d599caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Mon, 9 Jun 2025 11:32:52 +0200 Subject: [PATCH] feat!: Remove `replies` from `sv::features` pre 2.0.0 release --- .../generic_contract/src/contract.rs | 1 - .../generics_forwarded/src/contract.rs | 1 - sylvia-derive/src/contract.rs | 8 ++--- sylvia-derive/src/contract/mt.rs | 18 ++--------- sylvia-derive/src/entry_points.rs | 16 +++------- sylvia-derive/src/lib.rs | 18 +---------- .../src/parser/attributes/features.rs | 28 +++++----------- sylvia/tests/messages_generation.rs | 1 - sylvia/tests/reply_data.rs | 1 - sylvia/tests/reply_dispatch.rs | 1 - sylvia/tests/reply_generation.rs | 1 - .../ui/attributes/data/invalid_params.rs | 2 -- .../ui/attributes/data/invalid_params.stderr | 8 ++--- .../tests/ui/attributes/data/invalid_usage.rs | 2 -- .../ui/attributes/data/invalid_usage.stderr | 12 +++---- .../attributes/features/invalid_params.stderr | 2 +- .../msg/overlapping_reply_handlers.rs | 1 - .../msg/overlapping_reply_handlers.stderr | 8 ++--- .../ui/attributes/payload/invalid_params.rs | 1 - .../attributes/payload/invalid_params.stderr | 4 +-- .../ui/attributes/payload/invalid_usage.rs | 2 -- .../attributes/payload/invalid_usage.stderr | 12 +++---- sylvia/tests/ui/method_signature/reply.rs | 3 -- sylvia/tests/ui/method_signature/reply.stderr | 32 +++++++++---------- 24 files changed, 57 insertions(+), 126 deletions(-) diff --git a/examples/contracts/generic_contract/src/contract.rs b/examples/contracts/generic_contract/src/contract.rs index 481adcd6..8aeda6c3 100644 --- a/examples/contracts/generic_contract/src/contract.rs +++ b/examples/contracts/generic_contract/src/contract.rs @@ -54,7 +54,6 @@ pub struct GenericContract< #[sv::messages(generic as Generic: custom(msg, query))] #[sv::messages(custom_and_generic as CustomAndGeneric)] #[sv::custom(msg=SvCustomMsg, query=SvCustomQuery)] -#[sv::features(replies)] impl< InstantiateT, Exec1T, diff --git a/examples/contracts/generics_forwarded/src/contract.rs b/examples/contracts/generics_forwarded/src/contract.rs index 6b931ac8..8840c0b5 100644 --- a/examples/contracts/generics_forwarded/src/contract.rs +++ b/examples/contracts/generics_forwarded/src/contract.rs @@ -57,7 +57,6 @@ pub struct GenericsForwardedContract< #[sv::messages(cw1 as Cw1: custom(msg, query))] #[sv::messages(custom_and_generic as CustomAndGeneric)] #[sv::custom(msg=CustomMsgT, query=CustomQueryT)] -#[sv::features(replies)] impl< InstantiateT, Exec1T, diff --git a/sylvia-derive/src/contract.rs b/sylvia-derive/src/contract.rs index 229bab92..34d3468b 100644 --- a/sylvia-derive/src/contract.rs +++ b/sylvia-derive/src/contract.rs @@ -47,7 +47,7 @@ pub struct ContractInput<'a> { custom: Custom, override_entry_points: Vec, interfaces: Interfaces, - sv_features: SylviaFeatures, + _sv_features: SylviaFeatures, } impl<'a> ContractInput<'a> { @@ -69,7 +69,7 @@ impl<'a> ContractInput<'a> { custom, override_entry_points, interfaces, - sv_features, + _sv_features: sv_features, } } @@ -189,10 +189,6 @@ impl<'a> ContractInput<'a> { } fn emit_reply(&self) -> TokenStream { - if !self.sv_features.replies { - return quote! {}; - } - let variants = MsgVariants::new(self.item.as_variants(), MsgType::Reply, &[], &None); Reply::new(self.item, &self.generics, &variants).emit() diff --git a/sylvia-derive/src/contract/mt.rs b/sylvia-derive/src/contract/mt.rs index fa8e2b9f..8232f609 100644 --- a/sylvia-derive/src/contract/mt.rs +++ b/sylvia-derive/src/contract/mt.rs @@ -4,7 +4,6 @@ use quote::quote; use syn::{parse_quote, GenericParam, ItemImpl, Type}; use crate::crate_module; -use crate::parser::attributes::features::SylviaFeatures; use crate::parser::attributes::msg::MsgType; use crate::parser::variant_descs::AsVariantDescs; use crate::parser::{ @@ -24,7 +23,6 @@ pub struct MtHelpers<'a> { where_clause: &'a Option, custom: &'a Custom, override_entry_points: Vec, - sv_features: SylviaFeatures, instantiate_variant: MsgVariants<'a, GenericParam>, exec_variants: MsgVariants<'a, GenericParam>, query_variants: MsgVariants<'a, GenericParam>, @@ -81,7 +79,6 @@ impl<'a> MtHelpers<'a> { let parsed_attrs = ParsedSylviaAttributes::new(source.attrs.iter()); let error_type = parsed_attrs.error_attrs.unwrap_or_default().error; let error_type = parse_quote! { #error_type }; - let sv_features = parsed_attrs.sv_features; let contract_name = &source.self_ty; @@ -93,7 +90,6 @@ impl<'a> MtHelpers<'a> { contract_name, custom, override_entry_points, - sv_features, instantiate_variant, exec_variants, query_variants, @@ -480,7 +476,6 @@ impl<'a> MtHelpers<'a> { contract_name, custom, override_entry_points, - sv_features, generic_params, migrate_variants, reply_variants, @@ -532,16 +527,9 @@ impl<'a> MtHelpers<'a> { quote! { #contract_ident } }; - if sv_features.replies { - quote! { - let contract = #contract_turbofish ::new(); - dispatch_reply(deps, env, msg, contract).map_err(Into::into) - } - } else { - let reply_name = _reply.name().to_case(Case::Snake); - quote! { - self. #reply_name ((deps, env).into(), msg).map_err(Into::into) - } + quote! { + let contract = #contract_turbofish ::new(); + dispatch_reply(deps, env, msg, contract).map_err(Into::into) } }) .unwrap_or_else(|| { diff --git a/sylvia-derive/src/entry_points.rs b/sylvia-derive/src/entry_points.rs index 96c5a6ad..269f01d9 100644 --- a/sylvia-derive/src/entry_points.rs +++ b/sylvia-derive/src/entry_points.rs @@ -69,7 +69,7 @@ pub struct EntryPoints<'a> { generics: Vec<&'a GenericParam>, where_clause: &'a Option, attrs: &'a EntryPointArgs, - sv_features: SylviaFeatures, + _sv_features: SylviaFeatures, } impl<'a> EntryPoints<'a> { @@ -99,7 +99,7 @@ impl<'a> EntryPoints<'a> { generics, where_clause, attrs, - sv_features, + _sv_features: sv_features, } } @@ -172,12 +172,7 @@ impl<'a> EntryPoints<'a> { fn emit_default_entry_point(&self, msg_ty: MsgType) -> TokenStream { let Self { - name, - error, - attrs, - reply, - sv_features, - .. + name, error, attrs, .. } = self; let sylvia = crate_module(); @@ -206,13 +201,10 @@ impl<'a> EntryPoints<'a> { _ => quote! { msg: < #contract as #sylvia ::types::ContractApi> :: #associated_name }, }; let dispatch = match msg_ty { - MsgType::Reply if sv_features.replies => quote! { + MsgType::Reply => quote! { let contract = #contract_turbofish ::new(); sv::dispatch_reply(deps, env, msg, contract).map_err(Into::into) }, - MsgType::Reply => quote! { - #contract_turbofish ::new(). #reply((deps, env).into(), msg).map_err(Into::into) - }, _ => quote! { msg.dispatch(& #contract_turbofish ::new() , ( #values )).map_err(Into::into) }, diff --git a/sylvia-derive/src/lib.rs b/sylvia-derive/src/lib.rs index 934d7ef7..df15979a 100644 --- a/sylvia-derive/src/lib.rs +++ b/sylvia-derive/src/lib.rs @@ -282,7 +282,6 @@ fn interface_impl(_attr: TokenStream2, item: TokenStream2) -> TokenStream2 { /// /// ##[sylvia::contract] /// ##[sv::error(ContractError)] -/// ##[sv::features(replies)] /// impl SvContract { /// pub const fn new() -> Self { /// Self { @@ -628,29 +627,15 @@ fn interface_impl(_attr: TokenStream2, item: TokenStream2) -> TokenStream2 { /// Enables additional features for the contract. Allows user to use features that /// are considered breaking before the major release. /// -/// Currently supported features are: -/// * `replies` - enables better dispatching of `reply` as well as its auto deserialization. -/// With this feature enabled, user can use additional parameters in the -/// `sv::msg` attribute like so: -/// `#[sv::msg(reply, handlers=[scenario1, scenario2], reply_on=Success)]`. -/// -/// Based on this parameters reply ids will be generated and associated with -/// proper scenario specified by the `reply_on` parameter. -/// -/// User can also specify custom `data` and `payload` types that will be auto -/// deserialized from the `cosmwasm_std::Binary` type. +/// No currently supported features. /// /// ### `sv::payload(raw)` /// -/// Requires contract to be marked with the `sv::features(replies)`. -/// /// Used next to the reply method argument. It disables auto deserialization /// of the payload argument. /// /// ### `sv::data(...)` /// -/// Requires contract to be marked with the `sv::features(replies)`. -/// /// Used next to the reply method argument. Based on the passed parameters /// it enables different behavior: /// @@ -740,7 +725,6 @@ fn contract_impl(attr: TokenStream2, item: TokenStream2) -> TokenStream2 { /// /// ##[sylvia::entry_points] /// ##[sylvia::contract] -/// ##[sv::features(replies)] /// impl SvContract { /// pub const fn new() -> Self { /// Self diff --git a/sylvia-derive/src/parser/attributes/features.rs b/sylvia-derive/src/parser/attributes/features.rs index 185935d5..7d1f13ee 100644 --- a/sylvia-derive/src/parser/attributes/features.rs +++ b/sylvia-derive/src/parser/attributes/features.rs @@ -1,13 +1,10 @@ use proc_macro_error::emit_error; use syn::parse::{Parse, ParseStream, Parser}; -use syn::{Error, Ident, MetaList, Result, Token}; +use syn::{Error, Ident, MetaList, Result}; /// Type wrapping data parsed from `sv::features` attribute. #[derive(Debug, Default)] -pub struct SylviaFeatures { - /// Enables better dispatching and deserialization for replies. - pub replies: bool, -} +pub struct SylviaFeatures {} impl SylviaFeatures { pub fn new(attr: &MetaList) -> Result { @@ -22,23 +19,14 @@ impl SylviaFeatures { impl Parse for SylviaFeatures { fn parse(input: ParseStream) -> Result { - let mut features = Self::default(); + let features = Self::default(); - while !input.is_empty() { + if !input.is_empty() { let feature: Ident = input.parse()?; - match feature.to_string().as_str() { - "replies" => features.replies = true, - _ => { - return Err(Error::new( - feature.span(), - "Invalid feature.\n= note: Supported features for contract macro: [`replies`].\n", - )) - } - } - if !input.peek(Token![,]) { - break; - } - let _: Token![,] = input.parse()?; + return Err(Error::new( + feature.span(), + "Invalid feature.\n= note: No features supported currently.\n", + )); } Ok(features) diff --git a/sylvia/tests/messages_generation.rs b/sylvia/tests/messages_generation.rs index 86ed0bab..a87a82a3 100644 --- a/sylvia/tests/messages_generation.rs +++ b/sylvia/tests/messages_generation.rs @@ -87,7 +87,6 @@ mod contract { #[sv::msg_attr(instantiate, error("Instantiate"))] #[sv::msg_attr(migrate, derive(PartialOrd, Error))] #[sv::msg_attr(migrate, error("Migrate"))] - #[sv::features(replies)] impl Contract { #[allow(clippy::new_without_default)] #[allow(dead_code)] diff --git a/sylvia/tests/reply_data.rs b/sylvia/tests/reply_data.rs index f3885aec..b38a3e72 100644 --- a/sylvia/tests/reply_data.rs +++ b/sylvia/tests/reply_data.rs @@ -83,7 +83,6 @@ pub struct Contract { #[entry_points] #[contract] #[sv::error(ContractError)] -#[sv::features(replies)] impl Contract { pub fn new() -> Self { Self { diff --git a/sylvia/tests/reply_dispatch.rs b/sylvia/tests/reply_dispatch.rs index ab4925ea..824cdc30 100644 --- a/sylvia/tests/reply_dispatch.rs +++ b/sylvia/tests/reply_dispatch.rs @@ -80,7 +80,6 @@ pub struct Contract { #[contract] #[sv::error(ContractError)] #[sv::custom(msg=M, query=Q)] -#[sv::features(replies)] impl Contract where M: CustomMsg + 'static, diff --git a/sylvia/tests/reply_generation.rs b/sylvia/tests/reply_generation.rs index 83a95fdb..82c9a940 100644 --- a/sylvia/tests/reply_generation.rs +++ b/sylvia/tests/reply_generation.rs @@ -9,7 +9,6 @@ pub struct Contract; #[entry_points] #[contract] -#[sv::features(replies)] impl Contract { pub fn new() -> Self { Self diff --git a/sylvia/tests/ui/attributes/data/invalid_params.rs b/sylvia/tests/ui/attributes/data/invalid_params.rs index 170e2777..c24f7753 100644 --- a/sylvia/tests/ui/attributes/data/invalid_params.rs +++ b/sylvia/tests/ui/attributes/data/invalid_params.rs @@ -10,7 +10,6 @@ pub mod invalid_data { pub struct Contract; #[contract] - #[sv::features(replies)] impl Contract { pub fn new() -> Self { Self @@ -39,7 +38,6 @@ pub mod instantiate_and_raw { pub struct Contract; #[contract] - #[sv::features(replies)] impl Contract { pub fn new() -> Self { Self diff --git a/sylvia/tests/ui/attributes/data/invalid_params.stderr b/sylvia/tests/ui/attributes/data/invalid_params.stderr index 47d4efe5..f3c957ad 100644 --- a/sylvia/tests/ui/attributes/data/invalid_params.stderr +++ b/sylvia/tests/ui/attributes/data/invalid_params.stderr @@ -1,16 +1,16 @@ error: Invalid data parameter. = note: Expected one of [`raw`, `opt`, `instantiate`] comma separated. - --> tests/ui/attributes/data/invalid_params.rs:28:24 + --> tests/ui/attributes/data/invalid_params.rs:27:24 | -28 | #[sv::data(invalid)] _data: Option, +27 | #[sv::data(invalid)] _data: Option, | ^^^^^^^ error: The `instantiate` cannot be used in pair with `raw` parameter. = note: Use any combination of [`raw`, `opt`] or [`instantiate`, `opt`] pairs. - --> tests/ui/attributes/data/invalid_params.rs:57:24 + --> tests/ui/attributes/data/invalid_params.rs:55:24 | -57 | #[sv::data(instantiate, raw)] _data: Option, +55 | #[sv::data(instantiate, raw)] _data: Option, | ^^^^^^^^^^^ diff --git a/sylvia/tests/ui/attributes/data/invalid_usage.rs b/sylvia/tests/ui/attributes/data/invalid_usage.rs index 92ca86b8..7809a232 100644 --- a/sylvia/tests/ui/attributes/data/invalid_usage.rs +++ b/sylvia/tests/ui/attributes/data/invalid_usage.rs @@ -8,7 +8,6 @@ pub mod attributes_swapped { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} @@ -37,7 +36,6 @@ pub mod error_handler { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} diff --git a/sylvia/tests/ui/attributes/data/invalid_usage.stderr b/sylvia/tests/ui/attributes/data/invalid_usage.stderr index fd6884a4..821edcb1 100644 --- a/sylvia/tests/ui/attributes/data/invalid_usage.stderr +++ b/sylvia/tests/ui/attributes/data/invalid_usage.stderr @@ -2,18 +2,18 @@ error: Wrong usage of `#[sv::data]` attribute. = note: The `#[sv::data]` attribute can only be used on the first parameter after the `ReplyCtx`. - --> tests/ui/attributes/data/invalid_usage.rs:27:35 + --> tests/ui/attributes/data/invalid_usage.rs:26:35 | -27 | #[sv::data(opt, raw)] _data: Option, +26 | #[sv::data(opt, raw)] _data: Option, | ^^^^^ error: Redundant payload parameter. = note: Expected no parameters after the parameter marked with `#[sv::payload(raw)]`. - --> tests/ui/attributes/data/invalid_usage.rs:27:35 + --> tests/ui/attributes/data/invalid_usage.rs:26:35 | -27 | #[sv::data(opt, raw)] _data: Option, +26 | #[sv::data(opt, raw)] _data: Option, | ^^^^^ error: Wrong usage of `#[sv::data]` attribute. @@ -21,7 +21,7 @@ error: Wrong usage of `#[sv::data]` attribute. = note: The `#[sv::data]` attribute can only be used in `success` scenario. = note: Found usage in `error` scenario. - --> tests/ui/attributes/data/invalid_usage.rs:55:35 + --> tests/ui/attributes/data/invalid_usage.rs:53:35 | -55 | #[sv::data(opt, raw)] _data: Option, +53 | #[sv::data(opt, raw)] _data: Option, | ^^^^^ diff --git a/sylvia/tests/ui/attributes/features/invalid_params.stderr b/sylvia/tests/ui/attributes/features/invalid_params.stderr index 8178d725..1b698501 100644 --- a/sylvia/tests/ui/attributes/features/invalid_params.stderr +++ b/sylvia/tests/ui/attributes/features/invalid_params.stderr @@ -1,5 +1,5 @@ error: Invalid feature. - = note: Supported features for contract macro: [`replies`]. + = note: No features supported currently. --> tests/ui/attributes/features/invalid_params.rs:9:16 | 9 | #[sv::features(unknown_parameter)] diff --git a/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.rs b/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.rs index f19b7104..7f73bcf8 100644 --- a/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.rs +++ b/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.rs @@ -7,7 +7,6 @@ use sylvia::cw_std::{Reply, Response, StdResult}; pub struct Contract; #[contract] -#[sv::features(replies)] impl Contract { pub fn new() -> Self { Self diff --git a/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.stderr b/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.stderr index a452d773..782ac9d7 100644 --- a/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.stderr +++ b/sylvia/tests/ui/attributes/msg/overlapping_reply_handlers.stderr @@ -2,16 +2,16 @@ error: Duplicated reply handler. = note: Previous definition of handler=`HANDLER_1_REPLY_ID` for reply_on=`always` defined on `fn reply_always()` - --> tests/ui/attributes/msg/overlapping_reply_handlers.rs:31:32 + --> tests/ui/attributes/msg/overlapping_reply_handlers.rs:30:32 | -31 | #[sv::msg(reply, handlers=[handler1], reply_on=success)] +30 | #[sv::msg(reply, handlers=[handler1], reply_on=success)] | ^^^^^^^^ error: Duplicated reply handler. = note: Previous definition of handler=`HANDLER_2_REPLY_ID` for reply_on=`error` defined on `fn some_reply()` - --> tests/ui/attributes/msg/overlapping_reply_handlers.rs:51:8 + --> tests/ui/attributes/msg/overlapping_reply_handlers.rs:50:8 | -51 | fn handler2( +50 | fn handler2( | ^^^^^^^^ diff --git a/sylvia/tests/ui/attributes/payload/invalid_params.rs b/sylvia/tests/ui/attributes/payload/invalid_params.rs index 8efd89ae..853b1b0a 100644 --- a/sylvia/tests/ui/attributes/payload/invalid_params.rs +++ b/sylvia/tests/ui/attributes/payload/invalid_params.rs @@ -7,7 +7,6 @@ use sylvia::cw_std::{Binary, Reply, Response, StdResult}; pub struct Contract; #[contract] -#[sv::features(replies)] impl Contract { pub fn new() -> Self { Self diff --git a/sylvia/tests/ui/attributes/payload/invalid_params.stderr b/sylvia/tests/ui/attributes/payload/invalid_params.stderr index 0705ccd5..2917e5c0 100644 --- a/sylvia/tests/ui/attributes/payload/invalid_params.stderr +++ b/sylvia/tests/ui/attributes/payload/invalid_params.stderr @@ -1,6 +1,6 @@ error: Invalid payload parameter. = note: Expected [`raw`]. - --> tests/ui/attributes/payload/invalid_params.rs:26:23 + --> tests/ui/attributes/payload/invalid_params.rs:25:23 | -26 | #[sv::payload(invalid)] _param: Option, +25 | #[sv::payload(invalid)] _param: Option, | ^^^^^^^ diff --git a/sylvia/tests/ui/attributes/payload/invalid_usage.rs b/sylvia/tests/ui/attributes/payload/invalid_usage.rs index 1946aa27..3a531239 100644 --- a/sylvia/tests/ui/attributes/payload/invalid_usage.rs +++ b/sylvia/tests/ui/attributes/payload/invalid_usage.rs @@ -8,7 +8,6 @@ pub mod used_on_context { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} @@ -32,7 +31,6 @@ pub mod used_on_self { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} diff --git a/sylvia/tests/ui/attributes/payload/invalid_usage.stderr b/sylvia/tests/ui/attributes/payload/invalid_usage.stderr index 5b670502..7c5bfce2 100644 --- a/sylvia/tests/ui/attributes/payload/invalid_usage.stderr +++ b/sylvia/tests/ui/attributes/payload/invalid_usage.stderr @@ -3,18 +3,18 @@ error: Invalid usage of Sylvia attribute. = note: First and second arguments of the method should be `self` and `ctx` respectively. = note: Unexpected attribute on `ctx` parameter. - --> tests/ui/attributes/payload/invalid_usage.rs:23:25 + --> tests/ui/attributes/payload/invalid_usage.rs:22:25 | -23 | fn reply(&self, #[sv::payload(raw)] _ctx: ReplyCtx) -> StdResult { +22 | fn reply(&self, #[sv::payload(raw)] _ctx: ReplyCtx) -> StdResult { | ^ error: Missing payload parameter. = note: Expected at least one payload parameter at the end of parameter list. - --> tests/ui/attributes/payload/invalid_usage.rs:23:12 + --> tests/ui/attributes/payload/invalid_usage.rs:22:12 | -23 | fn reply(&self, #[sv::payload(raw)] _ctx: ReplyCtx) -> StdResult { +22 | fn reply(&self, #[sv::payload(raw)] _ctx: ReplyCtx) -> StdResult { | ^^^^^ error: Invalid usage of Sylvia attribute. @@ -22,7 +22,7 @@ error: Invalid usage of Sylvia attribute. = note: First and second arguments of the method should be `self` and `ctx` respectively. = note: Unexpected attribute on `self` parameter. - --> tests/ui/attributes/payload/invalid_usage.rs:48:13 + --> tests/ui/attributes/payload/invalid_usage.rs:46:13 | -48 | #[sv::payload(raw)] &self, +46 | #[sv::payload(raw)] &self, | ^ diff --git a/sylvia/tests/ui/method_signature/reply.rs b/sylvia/tests/ui/method_signature/reply.rs index 04dc6ddd..2b223849 100644 --- a/sylvia/tests/ui/method_signature/reply.rs +++ b/sylvia/tests/ui/method_signature/reply.rs @@ -8,7 +8,6 @@ pub mod mismatched_params { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} @@ -42,7 +41,6 @@ pub mod mismatched_param_arity { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} @@ -82,7 +80,6 @@ pub mod redundant_params { pub struct Contract {} #[sylvia::contract] - #[sv::features(replies)] impl Contract { pub const fn new() -> Self { Self {} diff --git a/sylvia/tests/ui/method_signature/reply.stderr b/sylvia/tests/ui/method_signature/reply.stderr index 2aad7223..85f765f7 100644 --- a/sylvia/tests/ui/method_signature/reply.stderr +++ b/sylvia/tests/ui/method_signature/reply.stderr @@ -3,9 +3,9 @@ error: Mismatched parameter in reply handlers. = note: Parameters for the `on_instantiated` handler have to be the same. = note: Previous parameter defined for the `on_instantiated` handler. - --> tests/ui/method_signature/reply.rs:27:13 + --> tests/ui/method_signature/reply.rs:26:13 | -27 | param: String, +26 | param: String, | ^^^^^ error: Mismatched quantity of method parameters. @@ -13,43 +13,43 @@ error: Mismatched quantity of method parameters. = note: Both `on_instantiated` handlers should have the same number of parameters. = note: Previous definition of on_instantiated handler. - --> tests/ui/method_signature/reply.rs:57:12 + --> tests/ui/method_signature/reply.rs:55:12 | -57 | fn first_reply( +55 | fn first_reply( | ^^^^^^^^^^^ error: Wrong usage of `#[sv::data]` attribute. = note: The `#[sv::data]` attribute can only be used on the first parameter after the `ReplyCtx`. - --> tests/ui/method_signature/reply.rs:102:35 - | -102 | #[sv::data(opt, raw)] _data: Option, - | ^^^^^ + --> tests/ui/method_signature/reply.rs:99:35 + | +99 | #[sv::data(opt, raw)] _data: Option, + | ^^^^^ error: Redundant payload parameter. = note: Expected no parameters between the parameter marked with `#[sv::data]` and `#[sv::payload(raw)]`. - --> tests/ui/method_signature/reply.rs:100:13 - | -100 | redundant_before1: u32, - | ^^^^^^^^^^^^^^^^^ + --> tests/ui/method_signature/reply.rs:97:13 + | +97 | redundant_before1: u32, + | ^^^^^^^^^^^^^^^^^ error: Redundant payload parameter. = note: Expected no parameters between the parameter marked with `#[sv::data]` and `#[sv::payload(raw)]`. - --> tests/ui/method_signature/reply.rs:113:13 + --> tests/ui/method_signature/reply.rs:110:13 | -113 | redundant_between1: u32, +110 | redundant_between1: u32, | ^^^^^^^^^^^^^^^^^^ error: Redundant payload parameter. = note: Expected no parameters after the parameter marked with `#[sv::payload(raw)]`. - --> tests/ui/method_signature/reply.rs:128:13 + --> tests/ui/method_signature/reply.rs:125:13 | -128 | redundant: Binary, +125 | redundant: Binary, | ^^^^^^^^^