Skip to content

Commit

Permalink
Update Rust to nightly-2024-12-22
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Dec 22, 2024
1 parent 100a57c commit 3327947
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 20 deletions.
2 changes: 1 addition & 1 deletion crates/sc-subspace-block-relay/src/consensus/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ where
who: PeerId,
request: BlockRequest<Block>,
) -> Result<Result<(Vec<u8>, ProtocolName), RequestFailure>, oneshot::Canceled> {
let full_download = request.max.map_or(false, |max_blocks| max_blocks > 1);
let full_download = request.max.is_some_and(|max_blocks| max_blocks > 1);
let ret = if full_download {
self.full_download(who, request.clone()).await
} else {
Expand Down
5 changes: 5 additions & 0 deletions crates/sp-domains-fraud-proof/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

//! Subspace fraud proof primitives for consensus chain.
#![cfg_attr(not(feature = "std"), no_std)]
// `generic_const_exprs` is an incomplete feature
#![allow(incomplete_features)]
// TODO: This feature is not actually used in this crate, but is added as a workaround for
// https://github.com/rust-lang/rust/issues/133199
#![feature(generic_const_exprs)]
#![feature(associated_type_defaults)]

#[cfg(feature = "std")]
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-archiving/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ impl Archiver {
let continuation_object_mapping = BlockObjectMapping::V0 {
objects: object_mapping
.objects_mut()
.extract_if(|block_object: &mut BlockObject| {
.extract_if(.., |block_object: &mut BlockObject| {
if block_object.offset >= split_point as u32 {
block_object.offset -= split_point as u32;
true
Expand Down Expand Up @@ -570,7 +570,7 @@ impl Archiver {
let continuation_object_mapping = BlockObjectMapping::V0 {
objects: object_mapping
.objects_mut()
.extract_if(|block_object: &mut BlockObject| {
.extract_if(.., |block_object: &mut BlockObject| {
if block_object.offset >= split_point as u32 {
block_object.offset -= split_point as u32;
true
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-core-primitives/src/pieces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct PieceIndex(u64);

impl Step for PieceIndex {
#[inline]
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
u64::steps_between(&start.0, &end.0)
}

Expand Down Expand Up @@ -206,7 +206,7 @@ pub struct PieceOffset(u16);

impl Step for PieceOffset {
#[inline]
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
u16::steps_between(&start.0, &end.0)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-core-primitives/src/sectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub struct SBucket(u16);

impl Step for SBucket {
#[inline]
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
u16::steps_between(&start.0, &end.0)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-core-primitives/src/segments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct SegmentIndex(u64);

impl Step for SegmentIndex {
#[inline]
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
u64::steps_between(&start.0, &end.0)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer/src/cluster/controller/caches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl KnownCaches {
}

fn remove_expired(&mut self) -> impl Iterator<Item = KnownCache> + '_ {
self.known_caches.extract_if(|known_cache| {
self.known_caches.extract_if(.., |known_cache| {
known_cache.last_identification.elapsed() > self.identification_broadcast_interval * 2
})
}
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-proof-of-space/src/chiapos/table/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub(in super::super) struct X(u32);

impl Step for X {
#[inline(always)]
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
u32::steps_between(&start.0, &end.0)
}

Expand Down Expand Up @@ -89,7 +89,7 @@ pub(in super::super) struct Position(u32);

impl Step for Position {
#[inline(always)]
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
u32::steps_between(&start.0, &end.0)
}

Expand Down
5 changes: 5 additions & 0 deletions crates/subspace-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![feature(const_trait_impl, variant_count)]
// `generic_const_exprs` is an incomplete feature
#![allow(incomplete_features)]
// TODO: This feature is not actually used in this crate, but is added as a workaround for
// https://github.com/rust-lang/rust/issues/133199
#![feature(generic_const_exprs)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
// TODO: remove when upstream issue is fixed
Expand Down
5 changes: 5 additions & 0 deletions crates/subspace-verification/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
#![forbid(unsafe_code)]
#![warn(rust_2018_idioms, missing_debug_implementations, missing_docs)]
#![feature(array_chunks, portable_simd)]
// `generic_const_exprs` is an incomplete feature
#![allow(incomplete_features)]
// TODO: This feature is not actually used in this crate, but is added as a workaround for
// https://github.com/rust-lang/rust/issues/133199
#![feature(generic_const_exprs)]
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
Expand Down
2 changes: 1 addition & 1 deletion docker/bootstrap-node.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG RUSTC_VERSION=nightly-2024-10-22
ARG RUSTC_VERSION=nightly-2024-12-22
ARG PROFILE=production
ARG RUSTFLAGS
# Incremental compilation here isn't helpful
Expand Down
2 changes: 1 addition & 1 deletion docker/farmer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG RUSTC_VERSION=nightly-2024-10-22
ARG RUSTC_VERSION=nightly-2024-12-22
ARG PROFILE=production
ARG RUSTFLAGS
# Incremental compilation here isn't helpful
Expand Down
2 changes: 1 addition & 1 deletion docker/gateway.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG RUSTC_VERSION=nightly-2024-10-22
ARG RUSTC_VERSION=nightly-2024-12-22
ARG PROFILE=production
ARG RUSTFLAGS
# Incremental compilation here isn't helpful
Expand Down
2 changes: 1 addition & 1 deletion docker/node.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG RUSTC_VERSION=nightly-2024-10-22
ARG RUSTC_VERSION=nightly-2024-12-22
ARG PROFILE=production
ARG RUSTFLAGS
# Incremental compilation here isn't helpful
Expand Down
2 changes: 1 addition & 1 deletion docker/runtime.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64
FROM --platform=$BUILDPLATFORM ubuntu:22.04

ARG RUSTC_VERSION=nightly-2024-10-22
ARG RUSTC_VERSION=nightly-2024-12-22
ARG PROFILE=production
ARG RUSTFLAGS
# Incremental compilation here isn't helpful
Expand Down
2 changes: 1 addition & 1 deletion domains/client/domain-operator/src/fraud_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ where

let proof_data = if invalid_type
.extrinsic_index()
.map_or(false, |idx| bundle.extrinsics.len() as u32 <= idx)
.is_some_and(|idx| bundle.extrinsics.len() as u32 <= idx)
{
// The bad receipt claims a non-exist extrinsic is invalid, in this case, generate a
// `bundle_with_proof` as proof data is enough
Expand Down
6 changes: 3 additions & 3 deletions domains/pallets/auto-id/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl<T: Config> Pallet<T> {
);

ensure!(
!CertificateRevocationList::<T>::get(issuer_id).map_or(false, |serials| {
!CertificateRevocationList::<T>::get(issuer_id).is_some_and(|serials| {
serials.iter().any(|s| {
*s == issuer_auto_id.certificate.serial()
|| *s == tbs_certificate.serial
Expand Down Expand Up @@ -517,7 +517,7 @@ impl<T: Config> Pallet<T> {
Error::<T>::ExpiredCertificate
);
ensure!(
!CertificateRevocationList::<T>::get(issuer_id).map_or(false, |serials| {
!CertificateRevocationList::<T>::get(issuer_id).is_some_and(|serials| {
serials.iter().any(|s| {
*s == issuer_auto_id.certificate.serial()
|| *s == tbs_certificate.serial
Expand Down Expand Up @@ -627,7 +627,7 @@ impl<T: Config> Pallet<T> {
};

ensure!(
!CertificateRevocationList::<T>::get(issuer_id).map_or(false, |serials| {
!CertificateRevocationList::<T>::get(issuer_id).is_some_and(|serials| {
serials.iter().any(|s| {
*s == auto_id.certificate.serial() || *s == issuer_auto_id.certificate.serial()
})
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-10-22"
channel = "nightly-2024-12-22"
components = ["rust-src"]
targets = ["wasm32-unknown-unknown"]
profile = "default"
5 changes: 5 additions & 0 deletions test/subspace-test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

#![cfg_attr(not(feature = "std"), no_std)]
#![feature(variant_count)]
// `generic_const_exprs` is an incomplete feature
#![allow(incomplete_features)]
// TODO: This feature is not actually used in this crate, but is added as a workaround for
// https://github.com/rust-lang/rust/issues/133199
#![feature(generic_const_exprs)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
// TODO: remove when upstream issue is fixed
Expand Down

0 comments on commit 3327947

Please sign in to comment.