Skip to content

chore: Update rust to nightly-2025-05-28 #4672

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ jobs:
exit 1
fi

- name: "Install: Rust stable toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Install: Rust beta toolchain"
uses: dtolnay/rust-toolchain@beta
with:
targets: wasm32v1-none

- name: "Check: Compiling gstd on stable"
- name: "Check: Compiling gstd on beta"
run: |
cargo +stable check -p gstd --target wasm32v1-none
cargo +stable check --manifest-path utils/wasm-builder/test-program/Cargo.toml
cargo +stable check --manifest-path utils/cargo-gbuild/test-program/Cargo.toml --workspace --target wasm32v1-none
cargo +beta check -p gstd --target wasm32v1-none
cargo +beta check --manifest-path utils/wasm-builder/test-program/Cargo.toml
cargo +beta check --manifest-path utils/cargo-gbuild/test-program/Cargo.toml --workspace --target wasm32v1-none

- name: "Check: crates-io packages publishing"
run: cargo +stable run --release -p crates-io publish --simulate --registry-path /tmp/cargo-http-registry
run: cargo +beta run --release -p crates-io publish --simulate --registry-path /tmp/cargo-http-registry

fuzzer:
runs-on: [kuberunner, github-runner-01]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"
license = "GPL-3.0"
homepage = "https://gear-tech.io"
repository = "https://github.com/gear-tech/gear"
rust-version = "1.85"
rust-version = "1.88"

[workspace]
resolver = "3"
Expand Down
8 changes: 4 additions & 4 deletions common/src/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ impl<T: AuxiliaryDoubleStorageWrap> DoubleMapStorage for T {
f: F,
) -> Option<R> {
T::with_storage_mut(|map| {
if let Some(inner_map) = map.inner.get_mut(&key1) {
if let Some(value) = inner_map.get_mut(&key2) {
return Some(f(value));
}
if let Some(inner_map) = map.inner.get_mut(&key1)
&& let Some(value) = inner_map.get_mut(&key2)
{
return Some(f(value));
}

None
Expand Down
8 changes: 4 additions & 4 deletions common/src/gas_provider/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,10 @@ where
return Err(InternalError::consumed_with_lock().into());
}

if let Some(system_reserve) = node.system_reserve() {
if !system_reserve.is_zero() {
return Err(InternalError::consumed_with_system_reservation().into());
}
if let Some(system_reserve) = node.system_reserve()
&& !system_reserve.is_zero()
{
return Err(InternalError::consumed_with_system_reservation().into());
}

node.mark_consumed();
Expand Down
30 changes: 15 additions & 15 deletions common/src/gas_provider/property_tests/assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ fn assert_removed_nodes_form_path(
// Check that only `Cut` is removed after `consume`
#[track_caller]
fn assert_only_cut_node_removed(consumed: NodeId, removed_nodes: &RemovedNodes) {
if let Some(node) = removed_nodes.get(&consumed) {
if node.is_cut() {
// only `Cut` must be removed
assert_eq!(removed_nodes.len(), 1);
}
if let Some(node) = removed_nodes.get(&consumed)
&& node.is_cut()
{
// only `Cut` must be removed
assert_eq!(removed_nodes.len(), 1);
}
}

Expand Down Expand Up @@ -192,16 +192,16 @@ pub(super) fn assert_root_children_removed(

#[track_caller]
fn assert_another_root_not_removed(consumed: NodeId, removed_nodes: &RemovedNodes) {
if let Some(node) = removed_nodes.get(&consumed) {
if node.is_external() || node.is_reserved() {
assert_eq!(
removed_nodes
.iter()
.filter(|(_, v)| v.is_external() || v.is_reserved())
.count(),
1 // only `root_node`
);
}
if let Some(node) = removed_nodes.get(&consumed)
&& (node.is_external() || node.is_reserved())
{
assert_eq!(
removed_nodes
.iter()
.filter(|(_, v)| v.is_external() || v.is_reserved())
.count(),
1 // only `root_node`
);
}
}

Expand Down
4 changes: 1 addition & 3 deletions common/src/gas_provider/property_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,8 @@ proptest! {
// Check property: if node has non-zero value, it's a patron node (either not consumed or with unspec refs)
// (Actually, patron can have 0 inner value, when `spend` decreased it's balance to 0, but it's an edge case)
// `Cut` node can be not consumed with non zero value, but is not a patron
if let Some(value) = node.value() {
if value != 0 && !node.is_cut() {
if let Some(value) = node.value() && value != 0 && !node.is_cut() {
assert!(node.is_patron());
}
}

// Check property: all nodes have ancestor (node is a self-ancestor too) with value
Expand Down
8 changes: 4 additions & 4 deletions core/src/code/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ pub fn get_exports(module: &Module) -> BTreeSet<DispatchKind> {
.as_ref()
.expect("Exports section has been checked for already")
{
if let ExternalKind::Func = entry.kind {
if let Some(entry) = DispatchKind::try_from_entry(&entry.name) {
entries.insert(entry);
}
if let ExternalKind::Func = entry.kind
&& let Some(entry) = DispatchKind::try_from_entry(&entry.name)
{
entries.insert(entry);
}
}

Expand Down
58 changes: 30 additions & 28 deletions core/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,32 +378,32 @@ impl AllocationsContext {
});
}

if let Some(stack_end) = stack_end {
if stack_end > static_pages {
return Err(MemorySetupError::StackEndOutOfStaticMemory {
stack_end,
static_pages,
});
}
if let Some(stack_end) = stack_end
&& stack_end > static_pages
{
return Err(MemorySetupError::StackEndOutOfStaticMemory {
stack_end,
static_pages,
});
}

if let Some(page) = allocations.end() {
if page >= memory_size {
return Err(MemorySetupError::AllocatedPageOutOfAllowedInterval {
page,
static_pages,
memory_size,
});
}
if let Some(page) = allocations.end()
&& page >= memory_size
{
return Err(MemorySetupError::AllocatedPageOutOfAllowedInterval {
page,
static_pages,
memory_size,
});
}
if let Some(page) = allocations.start() {
if page < static_pages {
return Err(MemorySetupError::AllocatedPageOutOfAllowedInterval {
page,
static_pages,
memory_size,
});
}
if let Some(page) = allocations.start()
&& page < static_pages
{
return Err(MemorySetupError::AllocatedPageOutOfAllowedInterval {
page,
static_pages,
memory_size,
});
}

Ok(())
Expand Down Expand Up @@ -460,11 +460,13 @@ impl AllocationsContext {

/// Free specific memory page.
pub fn free(&mut self, page: WasmPage) -> Result<(), AllocError> {
if let Some(heap) = self.heap {
if page >= heap.start() && page <= heap.end() && self.allocations.remove(page) {
self.allocations_changed = true;
return Ok(());
}
if let Some(heap) = self.heap
&& page >= heap.start()
&& page <= heap.end()
&& self.allocations.remove(page)
{
self.allocations_changed = true;
return Ok(());
}
Err(AllocError::InvalidFree(page))
}
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM amazonlinux:2023 as builder

ARG PROFILE=production
ARG TOOLCHAIN=nightly-2025-05-09
ARG TOOLCHAIN=nightly-2025-05-28

RUN yum update -y && \
yum install -y clang gcc git gzip make tar wget unzip && \
Expand Down
4 changes: 2 additions & 2 deletions ethexe/docker/ethexe_builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ RUN wget https://sh.rustup.rs/rustup-init.sh
RUN chmod +x rustup-init.sh
RUN ./rustup-init.sh -y
ENV PATH="/root/.cargo/bin:$PATH"
RUN rustup toolchain install nightly-2025-05-09
RUN rustup target add wasm32v1-none --toolchain nightly-2025-05-09
RUN rustup toolchain install nightly-2025-05-28
RUN rustup target add wasm32v1-none --toolchain nightly-2025-05-28

# Build
RUN cargo build -p ethexe-cli --profile $PROFILE
Expand Down
14 changes: 7 additions & 7 deletions ethexe/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ impl NetworkService {
//
BehaviourEvent::Kad(kad::Event::RoutingUpdated { peer, .. }) => {
let behaviour = self.swarm.behaviour_mut();
if let Some(mdns4) = behaviour.mdns4.as_ref() {
if mdns4.discovered_nodes().any(|&p| p == peer) {
// we don't want local peers to appear in KadDHT.
// event can be emitted few times in a row for
// the same peer, so we just ignore `None`
let _res = behaviour.kad.remove_peer(&peer);
}
if let Some(mdns4) = behaviour.mdns4.as_ref()
&& mdns4.discovered_nodes().any(|&p| p == peer)
{
// we don't want local peers to appear in KadDHT.
// event can be emitted few times in a row for
// the same peer, so we just ignore `None`
let _res = behaviour.kad.remove_peer(&peer);
}
}
BehaviourEvent::Kad(_) => {}
Expand Down
42 changes: 21 additions & 21 deletions ethexe/observer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,32 +176,32 @@ impl Stream for ObserverService {
return Poll::Ready(Some(Ok(ObserverEvent::Block(data))));
}

if self.sync_future.is_none() {
if let Some(header) = self.block_sync_queue.pop_front() {
let sync = ChainSync {
provider: self.provider.clone(),
db: self.db.clone(),
blobs_reader: self.blobs_reader.clone(),
config: self.config.clone(),
};
self.sync_future = Some(Box::pin(sync.sync(header)));
}
if self.sync_future.is_none()
&& let Some(header) = self.block_sync_queue.pop_front()
{
let sync = ChainSync {
provider: self.provider.clone(),
db: self.db.clone(),
blobs_reader: self.blobs_reader.clone(),
config: self.config.clone(),
};
self.sync_future = Some(Box::pin(sync.sync(header)));
}

if let Some(fut) = self.sync_future.as_mut() {
if let Poll::Ready(res) = fut.poll_unpin(cx) {
self.sync_future = None;
if let Some(fut) = self.sync_future.as_mut()
&& let Poll::Ready(res) = fut.poll_unpin(cx)
{
self.sync_future = None;

let res = res.map(|(hash, codes)| {
for (code_id, code_info) in codes {
self.lookup_code(code_id, code_info.timestamp, code_info.tx_hash);
}
let res = res.map(|(hash, codes)| {
for (code_id, code_info) in codes {
self.lookup_code(code_id, code_info.timestamp, code_info.tx_hash);
}

ObserverEvent::BlockSynced(hash)
});
ObserverEvent::BlockSynced(hash)
});

return Poll::Ready(Some(res));
}
return Poll::Ready(Some(res));
}

if let Poll::Ready(Some(res)) = self.codes_futures.poll_next_unpin(cx) {
Expand Down
14 changes: 7 additions & 7 deletions examples/fungible-token/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ impl FungibleToken {
if from == &source || self.balances.get(&source).unwrap_or(&0) >= &amount {
return true;
}
if let Some(allowed_amount) = self.allowances.get(from).and_then(|m| m.get(&source)) {
if allowed_amount >= &amount {
self.allowances.entry(*from).and_modify(|m| {
m.entry(source).and_modify(|a| *a -= amount);
});
return true;
}
if let Some(allowed_amount) = self.allowances.get(from).and_then(|m| m.get(&source))
&& allowed_amount >= &amount
{
self.allowances.entry(*from).and_modify(|m| {
m.entry(source).and_modify(|a| *a -= amount);
});
return true;
}
false
}
Expand Down
8 changes: 4 additions & 4 deletions gcli/src/cmd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ impl ConfigSettings {
/// there are more options in the settings.
pub fn write(&self, path: Option<PathBuf>) -> Result<()> {
let conf = path.unwrap_or(Self::config()?);
if let Some(parent) = conf.parent() {
if !parent.exists() {
fs::create_dir_all(parent)?;
}
if let Some(parent) = conf.parent()
&& !parent.exists()
{
fs::create_dir_all(parent)?;
}

fs::write(conf, toml::to_string_pretty(self)?).map_err(Into::into)
Expand Down
10 changes: 5 additions & 5 deletions gprimitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ impl fmt::Display for ActorId {
let mut e1 = median;
let mut s2 = median;

if let Some(precision) = f.precision() {
if precision < median {
e1 = precision;
s2 = len - precision;
}
if let Some(precision) = f.precision()
&& precision < median
{
e1 = precision;
s2 = len - precision;
}

let p1 = &address_str[..e1];
Expand Down
10 changes: 5 additions & 5 deletions gprimitives/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ impl fmt::Display for ByteSliceFormatter<'_> {
let mut e1 = median;
let mut s2 = median;

if let Some(precision) = f.precision() {
if precision < median {
e1 = precision;
s2 = len - precision;
}
if let Some(precision) = f.precision()
&& precision < median
{
e1 = precision;
s2 = len - precision;
}

let out1_len = e1 * 2;
Expand Down
9 changes: 4 additions & 5 deletions gsdk/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,11 @@ impl Api {

let mut fetched_keys = 0;
while let Some(key) = keys.next().await {
if let Some(storage_data) = storage.fetch_raw(key?).await? {
if let Ok(value) =
if let Some(storage_data) = storage.fetch_raw(key?).await?
&& let Ok(value) =
<(UserStoredMessage, Interval<u32>)>::decode(&mut &storage_data[..])
{
mailbox.push(value);
}
{
mailbox.push(value);
}

fetched_keys += 1;
Expand Down
Loading