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

Update to Rust stable 1.84.1 #7572

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2abef4a
Switch CI to new docker
athei Feb 14, 2025
a40c118
Allow non_local_definitions where needed
athei Feb 14, 2025
f3a15f9
Make impl non local
athei Feb 14, 2025
d8b1352
Make macros non local
athei Feb 14, 2025
df85056
Get rid of irrefutable matches
athei Feb 14, 2025
e341c12
Remove code thats unsafe for no reason
athei Feb 14, 2025
3a15bb5
Remove unnecessary lifetimes
athei Feb 14, 2025
dd868b1
Remove empty line triggering a lint
athei Feb 14, 2025
1c1e535
Don't manually implement div_ceil
athei Feb 14, 2025
efbbb7c
As bytes not required
athei Feb 14, 2025
1a5cd6c
Map_Or is not required
athei Feb 14, 2025
f53bef3
Update from athei running command 'fmt --clean'
github-actions[bot] Feb 14, 2025
85d33ad
Remove toolchain file for fixtures
athei Feb 17, 2025
a54c890
Merge branch 'master' into at/update-rust
athei Feb 17, 2025
4481424
Add missing documentation
athei Feb 17, 2025
34a7ce7
Silence warnings in doc or test code arising from FRAME macro referen…
athei Feb 17, 2025
a485b1d
Silence warning coming from external orchestra crate
athei Feb 17, 2025
55862cf
Replace redundant map_or
athei Feb 17, 2025
48d739e
Add missing feature
athei Feb 17, 2025
0fa3eef
Update UI tests
athei Feb 17, 2025
5d9a96d
Merge branch 'master' into at/update-rust
athei Feb 17, 2025
52c88df
Propagate feature
athei Feb 17, 2025
8754957
Merge branch 'master' into at/update-rust
athei Feb 17, 2025
9594992
Update from athei running command 'fmt --clean'
github-actions[bot] Feb 17, 2025
353f572
Update ui tests
athei Feb 18, 2025
3d8537a
Merge branch 'master' into at/update-rust
athei Feb 18, 2025
b027852
Disable failing ui test
athei Feb 18, 2025
50acd87
Revert "Disable failing ui test"
athei Feb 18, 2025
dc6229d
Bump trybuild to be compatible with newest Rust
athei Feb 18, 2025
6de5562
Merge branch 'master' into at/update-rust
athei Feb 18, 2025
3c2bc5b
Update UI tests
athei Feb 18, 2025
83b350e
Use `CARGO_ENCODED_RUSTFLAGS` in order to adapt to new trybuild version
athei Feb 18, 2025
7111fdb
Update ui tests
athei Feb 18, 2025
b948cdf
Merge branch 'master' into at/update-rust
athei Feb 18, 2025
c77b47d
Switch to CARGO_ENCODED_RUSTFLAGS
athei Feb 18, 2025
1112f82
Eliminate dead_code warning
athei Feb 18, 2025
5c1cda5
Update trybuild in cargo toml
athei Feb 18, 2025
cee6c17
Trigger CI
athei Feb 19, 2025
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
2 changes: 1 addition & 1 deletion .github/env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
IMAGE="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
IMAGE="docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220"
10 changes: 5 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ workflow:

variables:
# CI_IMAGE: !reference [ .ci-unified, variables, CI_IMAGE ]
CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220"
# BUILDAH_IMAGE is defined in group variables
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
RELENG_SCRIPTS_BRANCH: "master"
Expand Down Expand Up @@ -125,18 +125,18 @@ default:
- cat .forklift/config-gitlab.toml > .forklift/config.toml
- >
if [ "$FORKLIFT_BYPASS" != "true" ]; then
echo "FORKLIFT_BYPASS not set";
echo "FORKLIFT_BYPASS not set";
if command -v forklift >/dev/null 2>&1; then
echo "forklift already exists";
echo "forklift already exists";
forklift version
else
echo "forklift does not exist, downloading";
curl --header "PRIVATE-TOKEN: $FL_CI_GROUP_TOKEN" -o forklift -L "${CI_API_V4_URL}/projects/676/packages/generic/forklift/${FL_FORKLIFT_VERSION}/forklift_${FL_FORKLIFT_VERSION}_linux_amd64";
curl --header "PRIVATE-TOKEN: $FL_CI_GROUP_TOKEN" -o forklift -L "${CI_API_V4_URL}/projects/676/packages/generic/forklift/${FL_FORKLIFT_VERSION}/forklift_${FL_FORKLIFT_VERSION}_linux_amd64";
chmod +x forklift;
export PATH=$PATH:$(pwd);
echo ${FL_FORKLIFT_VERSION};
fi
echo "Creating alias cargo='forklift cargo'";
echo "Creating alias cargo='forklift cargo'";
shopt -s expand_aliases;
alias cargo="forklift cargo";
fi
Expand Down
23 changes: 10 additions & 13 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ trie-bench = { version = "0.39.0" }
trie-db = { version = "0.29.1", default-features = false }
trie-root = { version = "0.18.0", default-features = false }
trie-standardmap = { version = "0.16.0" }
trybuild = { version = "1.0.89" }
trybuild = { version = "1.0.103" }
tt-call = { version = "1.0.8" }
tuplex = { version = "0.1", default-features = false }
twox-hash = { version = "1.6.3", default-features = false }
Expand Down
9 changes: 3 additions & 6 deletions bridges/modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,9 @@ where
pub fn synced_headers_grandpa_info() -> Vec<StoredHeaderGrandpaInfo<BridgedHeader<T, I>>> {
frame_system::Pallet::<T>::read_events_no_consensus()
.filter_map(|event| {
if let Event::<T, I>::UpdatedBestFinalizedHeader { grandpa_info, .. } =
event.event.try_into().ok()?
{
return Some(grandpa_info)
}
None
let Event::<T, I>::UpdatedBestFinalizedHeader { grandpa_info, .. } =
event.event.try_into().ok()?;
Some(grandpa_info)
})
.collect()
}
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn make_justification_for_header<H: HeaderT>(
);

// Roughly, how many vote ancestries do we want per fork
let target_depth = (ancestors + forks - 1) / forks;
let target_depth = ancestors.div_ceil(forks);

let mut unsigned_precommits = vec![];
for i in 0..forks {
Expand Down
1 change: 1 addition & 0 deletions bridges/relays/lib-substrate-relay/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ mod tests {
}

// mock runtime with `pallet_bridge_messages`
#[allow(unexpected_cfgs)]
mod mock {
use super::super::*;
use bp_messages::{target_chain::ForbidInboundMessages, HashedLaneId};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ macro_rules! impl_node_runtime_apis {
unimplemented!()
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
_: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, String> {
Expand Down
2 changes: 1 addition & 1 deletion docs/contributor/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The command below allows building a Linux binary without having to even install
docker run --rm -it \
-w /polkadot-sdk \
-v $(pwd):/polkadot-sdk \
docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558 \
docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220 \
cargo build --release --locked -p polkadot-parachain-bin --bin polkadot-parachain
sudo chown -R $(id -u):$(id -g) target/
```
Expand Down
2 changes: 2 additions & 0 deletions docs/sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#![doc = simple_mermaid::mermaid!("../../mermaid/IA.mmd")]
#![warn(rustdoc::broken_intra_doc_links)]
#![warn(rustdoc::private_intra_doc_links)]
// Frame macros reference features which this crate does not have
#![allow(unexpected_cfgs)]
#![doc(html_favicon_url = "https://polkadot.com/favicon.ico")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/docs/images/Polkadot_Logo_Horizontal_Pink_White.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ async fn answer_expected_hypothetical_membership_request(
)
}

/// Assert that the correct peer is reported.
#[macro_export]
macro_rules! assert_peer_reported {
($virtual_overseer:expr, $peer_id:expr, $rep_change:expr $(,)*) => {
Expand Down
3 changes: 2 additions & 1 deletion polkadot/node/overseer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
// unused dependencies can not work for test and examples at the same time
// yielding false positives
#![warn(missing_docs)]
#![allow(dead_code)] // TODO https://github.com/paritytech/polkadot-sdk/issues/5793
// TODO https://github.com/paritytech/polkadot-sdk/issues/5793
#![allow(dead_code, irrefutable_let_patterns)]

use std::{
collections::{hash_map, HashMap},
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ std = [
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
"frame-support-test/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"libsecp256k1/hmac",
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ std = [
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support-test/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/parachains/src/coretime/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ mod v_coretime {
return None
},
};
let time_slice = (valid_until + TIMESLICE_PERIOD - 1) / TIMESLICE_PERIOD;
let time_slice = valid_until.div_ceil(TIMESLICE_PERIOD);
log::trace!(target: "coretime-migration", "Sending of lease holding para {:?}, valid_until: {:?}, time_slice: {:?}", p, valid_until, time_slice);
Some(mk_coretime_call::<T>(crate::coretime::CoretimeCalls::SetLease(p.into(), time_slice)))
});
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,7 @@ sp_api::impl_runtime_apis! {
return (list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig,
) -> Result<
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2648,6 +2648,7 @@ sp_api::impl_runtime_apis! {
return (list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig,
) -> Result<
Expand Down
2 changes: 2 additions & 0 deletions polkadot/xcm/docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
//!
//! ## Docs structure
#![doc = simple_mermaid::mermaid!("../mermaid/structure.mmd")]
// Frame macros reference features which this crate does not have
#![allow(unexpected_cfgs)]

/// Fundamentals of the XCM language. The virtual machine, instructions, locations and assets.
pub mod fundamentals;
Expand Down
5 changes: 5 additions & 0 deletions polkadot/xcm/xcm-simulator/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod parachain;

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod relay_chain;

#[cfg(test)]
Expand Down
5 changes: 5 additions & 0 deletions polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod parachain;

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod relay_chain;

use codec::DecodeLimit;
Expand Down
1 change: 1 addition & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4058,6 +4058,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
4 changes: 2 additions & 2 deletions substrate/client/allocator/src/freeing_bump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ pub struct AllocationStats {
///
/// Returns `None` if the number of pages to not fit into `u32`.
fn pages_from_size(size: u64) -> Option<u32> {
u32::try_from((size + PAGE_SIZE as u64 - 1) / PAGE_SIZE as u64).ok()
u32::try_from(size.div_ceil(PAGE_SIZE as u64)).ok()
}

/// An implementation of freeing bump allocator.
Expand Down Expand Up @@ -378,7 +378,7 @@ impl FreeingBumpHeapAllocator {
///
/// - `heap_base` - the offset from the beginning of the linear memory where the heap starts.
pub fn new(heap_base: u32) -> Self {
let aligned_heap_base = (heap_base + ALIGNMENT - 1) / ALIGNMENT * ALIGNMENT;
let aligned_heap_base = heap_base.div_ceil(ALIGNMENT) * ALIGNMENT;

FreeingBumpHeapAllocator {
original_heap_base: aligned_heap_base,
Expand Down
5 changes: 5 additions & 0 deletions substrate/client/merkle-mountain-range/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Test utilities.

use crate::MmrGadget;
use parking_lot::Mutex;
use sc_block_builder::BlockBuilderBuilder;
Expand Down Expand Up @@ -67,9 +69,12 @@ pub(crate) struct MmrBlock {
pub(crate) leaf_data: Vec<u8>,
}

/// Which kind of key type to use.
#[derive(Clone, Copy)]
pub enum OffchainKeyType {
/// Temporary key.
Temp,
/// Cononical key.
Canon,
}

Expand Down
Loading
Loading