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

chore: bump rust version to latest nightly #3571

Merged
merged 20 commits into from
Feb 2, 2024
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
d2d9cda
chore: support rust 1.76
StackOverflowExcept1on Dec 7, 2023
6605cfa
small fix
StackOverflowExcept1on Dec 8, 2023
aa1f8c8
update version
StackOverflowExcept1on Dec 9, 2023
ad341b8
fix clippy
StackOverflowExcept1on Dec 9, 2023
a571f9a
[skip-ci] fix new lints
StackOverflowExcept1on Dec 9, 2023
4f86ffd
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Dec 12, 2023
bf474e9
rm this file
StackOverflowExcept1on Dec 12, 2023
849dbb3
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Dec 30, 2023
e1a0498
try nightly-2024-01-25
StackOverflowExcept1on Jan 25, 2024
9f4742e
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Jan 25, 2024
bbc73fe
fix errors after merge
StackOverflowExcept1on Jan 25, 2024
00f0ac0
fix wasm builder
StackOverflowExcept1on Jan 25, 2024
93ab5a8
fix gstd tests
StackOverflowExcept1on Jan 25, 2024
7fc9671
fix fuzzer test
StackOverflowExcept1on Jan 25, 2024
bfe5ac2
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Jan 28, 2024
5317fc6
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Feb 1, 2024
26c1919
remove ptr::addr_of
StackOverflowExcept1on Feb 1, 2024
bf15a93
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Feb 2, 2024
e42c08e
remove gear_calls.rs after merge...
StackOverflowExcept1on Feb 2, 2024
9a9a157
some fixes
StackOverflowExcept1on Feb 2, 2024
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
8 changes: 4 additions & 4 deletions common/numerated/src/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ mod tests {
#[test]
fn size() {
assert_eq!(Interval::<u8>::try_from(11..111).unwrap().size(), Some(100),);
assert_eq!(Interval::<u8>::try_from(..1).unwrap().size(), Some(1),);
assert_eq!(Interval::<u8>::from(..1).size(), Some(1),);
assert_eq!(Interval::<u8>::from(..=1).size(), Some(2));
assert_eq!(Interval::<u8>::from(1..).size(), Some(255));
assert_eq!(Interval::<u8>::from(0..).size(), None);
Expand All @@ -452,15 +452,15 @@ mod tests {
Interval::<u8>::try_from(11..111).unwrap().raw_size(),
Some(100),
);
assert_eq!(Interval::<u8>::try_from(..1).unwrap().raw_size(), Some(1),);
assert_eq!(Interval::<u8>::from(..1).raw_size(), Some(1),);
assert_eq!(Interval::<u8>::from(..=1).raw_size(), Some(2));
assert_eq!(Interval::<u8>::from(1..).raw_size(), Some(255));
assert_eq!(Interval::<u8>::from(0..).raw_size(), None);
assert_eq!(Interval::<u8>::from(..).raw_size(), None);
assert_eq!(Interval::<u8>::try_from(1..1).unwrap().raw_size(), Some(0));

assert_eq!(Interval::<i8>::try_from(-1..99).unwrap().size(), Some(-28)); // corresponds to 100 numeration
assert_eq!(Interval::<i8>::try_from(..1).unwrap().size(), Some(1)); // corresponds to 129 numeration
assert_eq!(Interval::<i8>::from(..1).size(), Some(1)); // corresponds to 129 numeration
assert_eq!(Interval::<i8>::from(..=1).size(), Some(2)); // corresponds to 130 numeration
assert_eq!(Interval::<i8>::from(1..).size(), Some(-1)); // corresponds to 127 numeration
assert_eq!(Interval::<i8>::from(0..).size(), Some(0)); // corresponds to 128 numeration
Expand All @@ -471,7 +471,7 @@ mod tests {
Interval::<i8>::try_from(-1..99).unwrap().raw_size(),
Some(100)
);
assert_eq!(Interval::<i8>::try_from(..1).unwrap().raw_size(), Some(129));
assert_eq!(Interval::<i8>::from(..1).raw_size(), Some(129));
assert_eq!(Interval::<i8>::from(..=1).raw_size(), Some(130));
assert_eq!(Interval::<i8>::from(1..).raw_size(), Some(127));
assert_eq!(Interval::<i8>::from(0..).raw_size(), Some(128));
Expand Down
4 changes: 2 additions & 2 deletions common/src/gas_provider/property_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type Balance = u64;
type Funds = u128;

std::thread_local! {
static TOTAL_ISSUANCE: RefCell<Option<Balance>> = RefCell::new(None);
static TOTAL_ISSUANCE: RefCell<Option<Balance>> = const { RefCell::new(None) };
}

#[derive(Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -177,7 +177,7 @@ impl<T> From<ReservationKey> for GasNodeId<T, ReservationKey> {
}

std::thread_local! {
static GAS_TREE_NODES: RefCell<BTreeMap<Key, GasNode>> = RefCell::new(BTreeMap::new());
static GAS_TREE_NODES: RefCell<BTreeMap<Key, GasNode>> = const { RefCell::new(BTreeMap::new()) };
}

struct GasTreeNodesWrap;
Expand Down
2 changes: 0 additions & 2 deletions examples/constructor/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ impl Calls {
self
}

// TODO #3452: remove this on next rust update
#[allow(clippy::useless_conversion)]
pub fn add_from_iter(mut self, calls: impl Iterator<Item = Call>) -> Self {
self.0.extend(calls.into_iter());
self
Expand Down
2 changes: 1 addition & 1 deletion examples/constructor/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ static mut SCHEME: Option<Scheme> = None;
fn process_fn<'a>(f: impl Fn(&'a Scheme) -> Option<&'a Vec<Call>>) {
let scheme = unsafe { SCHEME.as_ref() }.expect("Should be set before access");
let calls = f(scheme)
.map(Clone::clone)
.cloned()
.unwrap_or_else(|| msg::load().expect("Failed to load payload"));

let mut res = None;
Expand Down
4 changes: 2 additions & 2 deletions examples/fungible-token/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ extern "C" fn state() {
decimals,
} = state;

let balances = balances.into_iter().map(|(k, v)| (k, v)).collect();
let balances = balances.into_iter().collect();
let allowances = allowances
.into_iter()
.map(|(id, allowance)| (id, allowance.into_iter().map(|(k, v)| (k, v)).collect()))
.map(|(id, allowance)| (id, allowance.into_iter().collect()))
.collect();
let payload = IoFungibleToken {
name,
Expand Down
4 changes: 2 additions & 2 deletions examples/fungible-token/tests/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async fn stress_test() -> Result<()> {
.encode();

let (message_id, program_id, _hash) = api
.upload_program_bytes(WASM_BINARY.to_vec(), [137u8], init_msg, MAX_GAS_LIMIT, 0)
.upload_program_bytes(WASM_BINARY, [137u8], init_msg, MAX_GAS_LIMIT, 0)
.await?;

assert!(listener.message_processed(message_id).await?.succeed());
Expand Down Expand Up @@ -229,7 +229,7 @@ async fn stress_transfer() -> Result<()> {

let salt: u8 = rng.gen();
let (message_id, program_id, _hash) = api
.upload_program_bytes(WASM_BINARY.to_vec(), [salt], init_msg, MAX_GAS_LIMIT, 0)
.upload_program_bytes(WASM_BINARY, [salt], init_msg, MAX_GAS_LIMIT, 0)
.await
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion examples/new-meta/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern "C" fn handle() {
let res = unsafe { &WALLETS }
.iter()
.find(|w| w.id.decimal == message_in.id.decimal)
.map(Clone::clone);
.cloned();

let message_out = MessageOut { res };

Expand Down
4 changes: 2 additions & 2 deletions examples/node/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn process(request: Request) -> Reply {
transition.query_list = state().sub_nodes.iter().cloned().collect();
let first_sub_node = *transition
.query_list
.get(0)
.first()
.expect("Checked above that sub_nodes is not empty; qed");
transition.last_sent_message_id =
msg::send(first_sub_node, request, 0).unwrap();
Expand Down Expand Up @@ -176,7 +176,7 @@ fn process(request: Request) -> Reply {
if let TransitionState::Ready = transition.state {
let first_sub_node = *transition
.query_list
.get(0)
.first()
.expect("Checked above that sub_nodes is not empty; qed");

transition.query_index = 0;
Expand Down
7 changes: 1 addition & 6 deletions gcli/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,12 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Common utils for integration tests
pub use self::{
args::Args,
node::{Convert, NodeExec},
result::{Error, Result},
};
pub use self::{args::Args, node::NodeExec, result::Result};
use gear_core::ids::{CodeId, ProgramId};
use gsdk::{
ext::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32},
testing::Node,
};
pub use scale_info::scale::Encode;
use std::{
iter::IntoIterator,
process::{Command, Output},
Expand Down
1 change: 0 additions & 1 deletion gclient/src/api/listener/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ mod subscription;

pub use gsdk::metadata::{gear::Event as GearEvent, Event};
pub use iterator::*;
pub use subscription::*;

use crate::{Error, Result};
use async_trait::async_trait;
Expand Down
2 changes: 0 additions & 2 deletions gclient/src/api/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
pub(crate) mod account_id;
mod block;

pub use block::*;

use super::{GearApi, Result};
use crate::Error;
use account_id::IntoAccountId32;
Expand Down
2 changes: 1 addition & 1 deletion gclient/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ mod api;
mod utils;
mod ws;

pub use api::{calls::*, error::*, listener::*, GearApi};
pub use api::{error::*, listener::*, GearApi};
pub use gsdk::metadata::errors;
pub use utils::*;
pub use ws::WSAddress;
3 changes: 1 addition & 2 deletions gsdk/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ impl Api {
],
);

let data: Option<(UserStoredMessage, Interval<u32>)> = self.fetch_storage(&addr).await.ok();
Ok(data.map(|(m, i)| (m, i)))
Ok(self.fetch_storage(&addr).await.ok())
}

/// Get all mailbox messages or for the provided `address`.
Expand Down
7 changes: 5 additions & 2 deletions gsdk/src/testing/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ impl Node {
return Err(Error::EmptyStderr);
};

for line in BufReader::new(stderr).lines().flatten() {
for line in BufReader::new(stderr)
.lines()
.map_while(|result| result.ok())
{
if line.contains(log) {
return Ok(line);
}
Expand All @@ -91,7 +94,7 @@ impl Node {
pub fn print_logs(&mut self) {
let stderr = self.process.stderr.as_mut();
let reader = BufReader::new(stderr.expect("Unable to get stderr"));
for line in reader.lines().flatten() {
for line in reader.lines().map_while(|result| result.ok()) {
println!("{line}");
}
}
Expand Down
2 changes: 1 addition & 1 deletion gstd/src/async_runtime/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl WakeSignals {
self.signals.contains_key(&reply_to)
}

pub fn poll(&mut self, reply_to: MessageId, cx: &Context<'_>) -> ReplyPoll {
pub fn poll(&mut self, reply_to: MessageId, cx: &mut Context<'_>) -> ReplyPoll {
match self.signals.remove(&reply_to) {
None => ReplyPoll::None,
Some(mut signal @ WakeSignal { payload: None, .. }) => {
Expand Down
5 changes: 3 additions & 2 deletions gstd/src/macros/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ macro_rules! debug {
#[macro_export]
macro_rules! dbg {
() => {
$crate::debug!("[{}:{}]", $crate::prelude::file!(), $crate::prelude::line!())
$crate::debug!("[{}:{}:{}]", $crate::prelude::file!(), $crate::prelude::line!(), $crate::prelude::column!())
};
($val:expr $(,)?) => {
match $val {
tmp => {
$crate::debug!("[{}:{}] {} = {:#?}",
$crate::debug!("[{}:{}:{}] {} = {:#?}",
$crate::prelude::file!(),
$crate::prelude::line!(),
$crate::prelude::column!(),
$crate::prelude::stringify!($val),
&tmp,
);
Expand Down
2 changes: 1 addition & 1 deletion gstd/src/msg/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use core::{
use futures::future::FusedFuture;
use scale_info::scale::Decode;

fn poll<F, R>(waiting_reply_to: MessageId, cx: &Context<'_>, f: F) -> Poll<Result<R>>
fn poll<F, R>(waiting_reply_to: MessageId, cx: &mut Context<'_>, f: F) -> Poll<Result<R>>
where
F: Fn(Vec<u8>) -> Result<R>,
{
Expand Down
3 changes: 2 additions & 1 deletion gstd/tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod sys {
}

#[test]
#[allow(static_mut_ref)]
fn test_debug() {
let value = 42;

Expand All @@ -28,6 +29,6 @@ fn test_debug() {
crate::dbg!(value);
assert_eq!(
unsafe { &DEBUG_MSG },
b"[gstd/tests/debug.rs:28] value = 42"
b"[gstd/tests/debug.rs:29:5] value = 42"
);
}
6 changes: 3 additions & 3 deletions pallets/gear-voucher/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ benchmarks! {
issue {
// Origin account.
let origin = benchmarking::account::<T::AccountId>("origin", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&origin,
100_000_000_000_000_u128.unique_saturated_into()
);
Expand Down Expand Up @@ -72,7 +72,7 @@ benchmarks! {
revoke {
// Origin account.
let origin = benchmarking::account::<T::AccountId>("origin", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&origin,
100_000_000_000_000_u128.unique_saturated_into()
);
Expand Down Expand Up @@ -102,7 +102,7 @@ benchmarks! {
update {
// Origin account.
let origin = benchmarking::account::<T::AccountId>("origin", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&origin,
100_000_000_000_000_u128.unique_saturated_into()
);
Expand Down
10 changes: 5 additions & 5 deletions pallets/gear/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,9 @@ benchmarks! {

claim_value {
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let program_id = benchmarking::account::<T::AccountId>("program", 0, 100);
CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let code = benchmarking::generate_wasm(16.into()).unwrap();
benchmarking::set_program::<ProgramStorageOf::<T>, _>(program_id.clone().cast(), code, 1.into());
let original_message_id = benchmarking::account::<T::AccountId>("message", 0, 100).cast();
Expand Down Expand Up @@ -527,7 +527,7 @@ benchmarks! {
send_message {
let p in 0 .. MAX_PAYLOAD_LEN;
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let minimum_balance = CurrencyOf::<T>::minimum_balance();
let program_id = benchmarking::account::<T::AccountId>("program", 0, 100).cast();
let code = benchmarking::generate_wasm(16.into()).unwrap();
Expand All @@ -543,10 +543,10 @@ benchmarks! {
send_reply {
let p in 0 .. MAX_PAYLOAD_LEN;
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let minimum_balance = CurrencyOf::<T>::minimum_balance();
let program_id = benchmarking::account::<T::AccountId>("program", 0, 100);
CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let code = benchmarking::generate_wasm(16.into()).unwrap();
benchmarking::set_program::<ProgramStorageOf::<T>, _>(program_id.clone().cast(), code, 1.into());
let original_message_id = benchmarking::account::<T::AccountId>("message", 0, 100).cast();
Expand Down
15 changes: 10 additions & 5 deletions pallets/gear/src/benchmarking/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ where
use demo_delayed_sender::WASM_BINARY;

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -53,7 +54,8 @@ where
use demo_reserve_gas::{InitAction, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -120,7 +122,8 @@ where
use demo_constructor::{Call, Calls, Scheme, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -176,7 +179,8 @@ where
use demo_waiter::{Command, WaitSubcommand, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -226,7 +230,8 @@ where
use demo_waiter::{Command, WaitSubcommand, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down
Loading
Loading