Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syn library update #1287

Merged
merged 20 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bdca39c
upgrading syn library from 1.0 to 2.0.39
mihaicalinluca Nov 27, 2023
099ffdf
changed AttributeArgs to MetaList
mihaicalinluca Nov 27, 2023
2fc6e80
added prints
mihaicalinluca Nov 28, 2023
11cd0ca
more organized logs, impl typeAbi for egldOrMultiEsdt
mihaicalinluca Nov 28, 2023
bf0f1fe
few more tries, small fix in egldOrMultiEsdt
mihaicalinluca Nov 28, 2023
f019165
added check for args
mihaicalinluca Nov 28, 2023
c49caf8
fixed for one optional token tree arg (such as endpoint)
mihaicalinluca Nov 29, 2023
075492a
fixed one string argument and one type argument parsing functions, us…
mihaicalinluca Nov 29, 2023
f83c798
fixed extract token identifier used in the payable attribute
mihaicalinluca Nov 29, 2023
ff0045e
fixed issue in attr_one_opt_token_tree_arg when it returned endpoint …
mihaicalinluca Nov 29, 2023
ad419c4
Merge branch 'master' into syn-library-update
mihaicalinluca Nov 29, 2023
e79f3d4
fixed doc attribute
mihaicalinluca Nov 29, 2023
300dcec
fixed wrong spacing and extra characters
mihaicalinluca Dec 5, 2023
d353b95
Merge branch 'master' into syn-library-update
mihaicalinluca Dec 7, 2023
d255dcb
deleted extra backslashes
mihaicalinluca Dec 11, 2023
15d87ee
Merge branch 'master' into syn-library-update
mihaicalinluca Dec 11, 2023
b9a3534
fix after review
mihaicalinluca Dec 11, 2023
26fd487
fixed remove backslashes
mihaicalinluca Dec 11, 2023
7e9e88e
Merge branch 'master' into syn-library-update
mihaicalinluca Dec 11, 2023
f8775b9
Merge branch 'master' into syn-library-update
andrei-marinica Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 3 additions & 14 deletions contracts/core/price-aggregator/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion contracts/examples/adder/src/adder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![no_std]

multiversx_sc::imports!();

andrei-marinica marked this conversation as resolved.
Show resolved Hide resolved
/// One of the simplest smart contracts possible,
/// it holds a single variable in storage, which anyone can increment.
#[multiversx_sc::contract]
Expand Down
17 changes: 3 additions & 14 deletions contracts/examples/adder/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/codec-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ default = ["syn/full", "syn/parsing", "syn/extra-traits"]
[dependencies]
proc-macro2 = "1.0.66"
quote = "1.0.33"
syn = "1.0"
syn = "2.0.39"
hex = "0.4"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::derive::TypeAbi;
/// - EGLD (can be zero in case of no payment whatsoever);
/// - Multi-ESDT (one or more ESDT transfers).
#[derive(
TopDecode, TopEncode, NestedDecode, NestedEncode, TypeAbi, Clone, PartialEq, Eq, Debug,
TopDecode, TopEncode, TypeAbi, NestedDecode, NestedEncode, Clone, PartialEq, Eq, Debug,
)]
pub enum EgldOrMultiEsdtPayment<M: ManagedTypeApi> {
Egld(BigUint<M>),
Expand Down
2 changes: 1 addition & 1 deletion framework/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories = ["cryptography::cryptocurrencies", "development-tools::procedural-m
[dependencies]
proc-macro2 = "1.0.66"
quote = "1.0.33"
syn = "1.0"
syn = "2.0.39"
hex = "0.4"
radix_trie = "0.2.1"

Expand Down
4 changes: 2 additions & 2 deletions framework/derive/src/generate/auto_impl_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use crate::{
model::{AutoImpl, ContractTrait, Method, MethodImpl},
parse::split_path_last,
};
use syn::{punctuated::Punctuated, token::Colon2};
use syn::{punctuated::Punctuated, token::PathSep};

/// Path to a Rust module containing a contract call proxy.
pub type ProxyModulePath = Punctuated<syn::PathSegment, Colon2>;
pub type ProxyModulePath = Punctuated<syn::PathSegment, PathSep>;

pub struct ProxyGetterReturnType {
pub module_path: ProxyModulePath,
Expand Down
2 changes: 0 additions & 2 deletions framework/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ pub fn proxy(
#[proc_macro_derive(TypeAbi)]
pub fn type_abi_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let ast = syn::parse(input).unwrap();

type_abi_derive::type_abi_derive(&ast)
}

#[proc_macro_derive(ManagedVecItem)]
pub fn managed_vec_item_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let ast = syn::parse(input).unwrap();

managed_vec_item_derive::managed_vec_item_derive(&ast)
}

Expand Down
6 changes: 3 additions & 3 deletions framework/derive/src/macro_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ pub fn process_contract(
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let new_input = trait_preprocessing(input);
let args_input = parse_macro_input!(args as syn::AttributeArgs);
let proc_input = &parse_macro_input!(new_input as syn::ItemTrait);
let proc_input = parse_macro_input!(new_input as syn::ItemTrait);

let contract = parse_contract_trait(args, &proc_input);

let contract = parse_contract_trait(args_input, proc_input);
validate_contract(&contract);

let contract_impl = contract_implementation(&contract, true);
Expand Down
3 changes: 1 addition & 2 deletions framework/derive/src/macro_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ pub fn process_module(
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let new_input = trait_preprocessing(input);
let args_input = parse_macro_input!(args as syn::AttributeArgs);
let proc_input = &parse_macro_input!(new_input as syn::ItemTrait);

let contract = parse_contract_trait(args_input, proc_input);
let contract = parse_contract_trait(args, proc_input);
validate_contract(&contract);

let contract_impl = contract_implementation(&contract, false);
Expand Down
3 changes: 1 addition & 2 deletions framework/derive/src/macro_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ pub fn process_proxy(
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let new_input = trait_preprocessing(input);
let args_input = parse_macro_input!(args as syn::AttributeArgs);
let proc_input = parse_macro_input!(new_input as syn::ItemTrait);

let contract = parse_contract_trait(args_input, &proc_input);
let contract = parse_contract_trait(args, &proc_input);
validate_contract(&contract);

let proxy_impl = proxy_implementation(&contract, true);
Expand Down
4 changes: 2 additions & 2 deletions framework/derive/src/model/supertrait.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use syn::{punctuated::Punctuated, token::Colon2};
use syn::{punctuated::Punctuated, token::PathSep};

/// Path to a Rust module containing a contract module.
pub type ModulePath = Punctuated<syn::PathSegment, Colon2>;
pub type ModulePath = Punctuated<syn::PathSegment, PathSep>;

#[derive(Clone, Debug)]
pub struct Supertrait {
Expand Down
4 changes: 2 additions & 2 deletions framework/derive/src/parse/argument_parse.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::attributes::*;
use crate::model::{ArgMetadata, ArgPaymentMetadata, MethodArgument};

pub fn extract_method_args(m: &syn::TraitItemMethod) -> Vec<MethodArgument> {
pub fn extract_method_args(m: &syn::TraitItemFn) -> Vec<MethodArgument> {
if m.sig.inputs.is_empty() {
missing_self_panic(m);
}
Expand Down Expand Up @@ -29,7 +29,7 @@ pub fn extract_method_args(m: &syn::TraitItemMethod) -> Vec<MethodArgument> {
.collect()
}

fn missing_self_panic(m: &syn::TraitItemMethod) -> ! {
fn missing_self_panic(m: &syn::TraitItemFn) -> ! {
panic!(
"Trait method `{}` must have `&self` as its first argument.",
m.sig.ident
Expand Down
Loading
Loading