Skip to content

Commit

Permalink
Merge pull request #1699 from multiversx/re-diagnose
Browse files Browse the repository at this point in the history
Reintroduced diagnostic::on_unimplemented & rustc 1.78 dependency
  • Loading branch information
andrei-marinica authored Jul 5, 2024
2 parents 1521ecb + cc305f6 commit 1f6564e
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 33 deletions.
52 changes: 31 additions & 21 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions data/codec-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proc-macro = true
default = ["syn/full", "syn/parsing", "syn/extra-traits"]

[dependencies]
proc-macro2 = "=1.0.82"
proc-macro2 = "=1.0.86"
quote = "=1.0.36"
syn = "=2.0.61"
syn = "=2.0.68"
hex = "=0.4.3"
2 changes: 1 addition & 1 deletion data/codec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ optional = true

[dependencies]
arrayvec = { version = "=0.7.4", default-features = false }
num-bigint = { version = "=0.4.5", optional = true } # can only be used in std contexts
num-bigint = { version = "0.4", optional = true } # can only be used in std contexts
unwrap-infallible = "0.1.5"

[dev-dependencies.multiversx-sc-codec-derive]
Expand Down
3 changes: 2 additions & 1 deletion framework/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "multiversx-sc"
version = "0.50.6"
edition = "2021"
rust-version = "1.78"

authors = ["Andrei Marinica <andrei.marinica@multiversx.com>", "MultiversX <contact@multiversx.com>"]
license = "GPL-3.0-only"
Expand All @@ -24,7 +25,7 @@ esdt-token-payment-legacy-decode = []

[dependencies]
hex-literal = "=0.4.1"
bitflags = "=2.5.0"
bitflags = "=2.6.0"
num-traits = { version = "=0.2.19", default-features = false }
unwrap-infallible = "0.1.5"

Expand Down
10 changes: 10 additions & 0 deletions framework/base/src/types/interaction/tx_data/tx_code_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ where
{
}

#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as code (does not implement `TxCodeValue<{Env}>`)",
label = "not a valid smart contract byte code",
note = "there are multiple ways to specify SC byte code, but `{Self}` is not one of them"
)]
pub trait TxCodeValue<Env>: AnnotatedValue<Env, ManagedBuffer<Env::Api>>
where
Env: TxEnv,
Expand All @@ -39,6 +44,11 @@ where
{
}

#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as code source value (does not implement `TxFromSourceValue<{Env}>`)",
label = "not an address from where to copy the code",
note = "there are multiple ways to specify a code source address, but `{Self}` is not one of them"
)]
pub trait TxFromSourceValue<Env>: AnnotatedValue<Env, ManagedAddress<Env::Api>>
where
Env: TxEnv,
Expand Down
5 changes: 5 additions & 0 deletions framework/base/src/types/interaction/tx_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ where
/// Marks the non-empty sender of a transaction.
///
/// Enforces the reciipent to be explicitly specified.
#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as a sender value (does not implement `TxFromSpecified<{Env}>`)",
label = "sender needs to be explicit",
note = "there are multiple ways to specify the sender value for a transaction, but `{Self}` is not one of them"
)]
pub trait TxFromSpecified<Env>:
TxFrom<Env> + AnnotatedValue<Env, ManagedAddress<Env::Api>>
where
Expand Down
5 changes: 5 additions & 0 deletions framework/base/src/types/interaction/tx_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ where
}
}

#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as gas value (does not implement `TxGasValue<{Env}>`)",
label = "not a valid value for gas",
note = "there are multiple ways to specify the gas value for a transaction, but `{Self}` is not one of them"
)]
pub trait TxGasValue<Env>: AnnotatedValue<Env, u64>
where
Env: TxEnv,
Expand Down
5 changes: 5 additions & 0 deletions framework/base/src/types/interaction/tx_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ use crate::{
use super::{AnnotatedValue, FunctionCall, TxEnv, TxFrom, TxToSpecified};

/// Describes a payment that is part of a transaction.
#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as payment (does not implement `TxPayment<{Env}>`)",
label = "not a valid payment type",
note = "there are multiple ways to specify the transaction payment, but `{Self}` is not one of them"
)]
pub trait TxPayment<Env>
where
Env: TxEnv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ use crate::types::TxEnv;
/// Result handler list item.
///
/// It acts as a result handler that produces a single result.
#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as a decoder result handler (does not implement `RHListItem<{Env}>`)",
label = "not a valid decoder result handler",
note = "there are multiple ways to specify the result handling, but `{Self}` is not one of them"
)]
pub trait RHListItem<Env, Original>
where
Env: TxEnv,
Expand Down
5 changes: 5 additions & 0 deletions framework/base/src/types/interaction/tx_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ impl<Env> TxTo<Env> for () where Env: TxEnv {}
/// Marks the non-empty recipient of a transaction.
///
/// Enforces the recipient to be explicitly specified.
#[diagnostic::on_unimplemented(
message = "Type `{Self}` cannot be used as recipient value (does not implement `TxToSpecified<{Env}>`)",
label = "recipient needs to be explicit",
note = "there are multiple ways to specify the recipient value for a transaction, but `{Self}` is not one of them"
)]
pub trait TxToSpecified<Env>: TxTo<Env> + AnnotatedValue<Env, ManagedAddress<Env::Api>>
where
Env: TxEnv,
Expand Down
4 changes: 2 additions & 2 deletions framework/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ keywords = ["multiversx", "blockchain", "contract"]
categories = ["cryptography::cryptocurrencies", "development-tools::procedural-macro-helpers"]

[dependencies]
proc-macro2 = "=1.0.82"
proc-macro2 = "=1.0.86"
quote = "=1.0.36"
syn = "=2.0.61"
syn = "=2.0.68"
hex = "=0.4.3"
radix_trie = "=0.2.1"

Expand Down
4 changes: 2 additions & 2 deletions framework/meta-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ colored = "2.0"
lazy_static = "1.4.0"
convert_case = "0.6.0"
hex = "0.4"
wasmparser = "0.208"
wasmprinter = "0.208"
wasmparser = "0.212"
wasmprinter = "0.212"
semver = "1.0.20"

[dependencies.multiversx-sc]
Expand Down
2 changes: 1 addition & 1 deletion framework/scenario/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sha2 = "0.10.6"
serde = "1.0"
serde_json = "1.0"
pathdiff = "0.2.1"
itertools = "0.12.0"
itertools = "0.13.0"
colored = "2.0"
unwrap-infallible = "0.1.5"

Expand Down
2 changes: 1 addition & 1 deletion sdk/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ base64 = "0.22"
pbkdf2 = { version = "0.12.2", default-features = false }
zeroize = "1.4.2"
bech32 = "0.9"
itertools = "0.12.0"
itertools = "0.13.0"
pem = "3.0.2"
log = "0.4.17"
4 changes: 2 additions & 2 deletions vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ num-traits = "0.2"
hex = "0.4"
sha2 = "0.10.6"
sha3 = "0.10.6"
itertools = "0.12.0"
itertools = "0.13.0"
hex-literal = "=0.4.1"
bitflags = "=2.5.0"
bitflags = "=2.6.0"
colored = "2.1.0"
rand = { version= "0.8.5", optional = true }
rand_seeder = { version= "0.2.2", optional = true }
Expand Down

0 comments on commit 1f6564e

Please sign in to comment.