Skip to content

Commit 400aabf

Browse files
authored
Update Rust to v1.89 (smol-dot#2159)
* Update Rust to v1.89 * Use `addr()` instead of `as usize`
1 parent b82deb9 commit 400aabf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+170
-164
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
test-64bits:
3131
runs-on: ubuntu-latest
3232
container:
33-
image: rust:1.88
33+
image: rust:1.89
3434
steps:
3535
- uses: actions/checkout@v4
3636
- uses: Swatinem/rust-cache@v2
@@ -39,7 +39,7 @@ jobs:
3939
test-32bits:
4040
runs-on: ubuntu-latest
4141
container:
42-
image: rust:1.88
42+
image: rust:1.89
4343
steps:
4444
- run: apt-get update && apt install -y libc6-dev-i386
4545
- uses: actions/checkout@v4
@@ -50,7 +50,7 @@ jobs:
5050
wasm-node-check:
5151
runs-on: ubuntu-latest
5252
container:
53-
image: rust:1.88
53+
image: rust:1.89
5454
steps:
5555
- uses: actions/checkout@v4
5656
- run: rustup target add wasm32-unknown-unknown
@@ -67,7 +67,7 @@ jobs:
6767
check-features:
6868
runs-on: ubuntu-latest
6969
container:
70-
image: rust:1.88
70+
image: rust:1.89
7171
steps:
7272
- uses: actions/checkout@v4
7373
- uses: Swatinem/rust-cache@v2
@@ -101,7 +101,7 @@ jobs:
101101
check-no-std:
102102
runs-on: ubuntu-latest
103103
container:
104-
image: rust:1.88
104+
image: rust:1.89
105105
steps:
106106
- uses: actions/checkout@v4
107107
- run: rustup target add thumbv7m-none-eabi
@@ -113,7 +113,7 @@ jobs:
113113
check-rustdoc-links:
114114
runs-on: ubuntu-latest
115115
container:
116-
image: rust:1.88
116+
image: rust:1.89
117117
steps:
118118
- uses: actions/checkout@v4
119119
- uses: Swatinem/rust-cache@v2
@@ -122,7 +122,7 @@ jobs:
122122
fmt:
123123
runs-on: ubuntu-latest
124124
container:
125-
image: rust:1.88
125+
image: rust:1.89
126126
steps:
127127
# Checks `rustfmt` formatting
128128
- uses: actions/checkout@v4
@@ -136,7 +136,7 @@ jobs:
136136
clippy:
137137
runs-on: ubuntu-latest
138138
container:
139-
image: rust:1.88
139+
image: rust:1.89
140140
steps:
141141
- uses: actions/checkout@v4
142142
# Since build artifacts are specific to a nightly version, we pin the specific nightly
@@ -177,7 +177,7 @@ jobs:
177177
wasm-node-versions-match:
178178
runs-on: ubuntu-latest
179179
container:
180-
image: rust:1.88
180+
image: rust:1.89
181181
steps:
182182
- uses: actions/checkout@v4
183183
- run: apt-get update && apt install -y jq

.github/workflows/deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
build-js-doc:
5757
runs-on: ubuntu-latest
5858
container:
59-
image: rust:1.88
59+
image: rust:1.89
6060
steps:
6161
- uses: actions/checkout@v4
6262
with:
@@ -83,7 +83,7 @@ jobs:
8383
build-rust-doc:
8484
runs-on: ubuntu-latest
8585
container:
86-
image: rust:1.88
86+
image: rust:1.89
8787
steps:
8888
- uses: actions/checkout@v4
8989
with:
@@ -104,7 +104,7 @@ jobs:
104104
build-tests-coverage:
105105
runs-on: ubuntu-latest
106106
container:
107-
image: rust:1.88
107+
image: rust:1.89
108108
steps:
109109
- run: apt update && apt install -y jq
110110
- run: rustup component add llvm-tools-preview
@@ -174,7 +174,7 @@ jobs:
174174
npm-publish:
175175
runs-on: ubuntu-latest
176176
container:
177-
image: rust:1.88
177+
image: rust:1.89
178178
steps:
179179
- uses: actions/checkout@v4
180180
- run: rustup target add wasm32-unknown-unknown
@@ -245,7 +245,7 @@ jobs:
245245
crates-io-publish:
246246
runs-on: ubuntu-latest
247247
container:
248-
image: rust:1.88
248+
image: rust:1.89
249249
steps:
250250
- uses: actions/checkout@v4
251251
- run: cargo publish --dry-run --locked

.github/workflows/periodic-cargo-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
cargo-update:
1010
runs-on: ubuntu-latest
1111
container:
12-
image: rust:1.88
12+
image: rust:1.89
1313
steps:
1414
- uses: actions/checkout@v4
1515
# Note: `cargo update --workspace` doesn't seem to have any effect.

full-node/src/consensus_service.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ pub struct Config {
114114
pub slot_duration_author_ratio: u16,
115115
}
116116

117-
/// Identifier for a blocks request to be performed.
118-
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
119-
pub struct BlocksRequestId(usize);
120-
121117
/// Summary of the state of the [`ConsensusService`].
122118
#[derive(Debug, Clone)]
123119
pub struct SyncState {

full-node/src/json_rpc_service/chain_head_subscriptions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub async fn spawn_chain_head_subscription_task(config: Config) -> String {
305305
return_value
306306
}
307307

308-
fn convert_runtime_spec(runtime: &executor::CoreVersion) -> methods::MaybeRuntimeSpec {
308+
fn convert_runtime_spec(runtime: &'_ executor::CoreVersion) -> methods::MaybeRuntimeSpec<'_> {
309309
let runtime = runtime.decode();
310310
methods::MaybeRuntimeSpec::Valid {
311311
spec: methods::RuntimeSpec {

full-node/src/json_rpc_service/requests_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ pub fn spawn_requests_handler(config: Config) {
832832
}));
833833
}
834834

835-
fn convert_runtime_version(runtime_spec: &executor::CoreVersion) -> methods::RuntimeVersion {
835+
fn convert_runtime_version(runtime_spec: &'_ executor::CoreVersion) -> methods::RuntimeVersion<'_> {
836836
let runtime_spec = runtime_spec.decode();
837837
methods::RuntimeVersion {
838838
spec_name: runtime_spec.spec_name.into(),

lib/src/chain/blocks_tree.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<T> NonFinalizedTree<T> {
246246

247247
/// Returns the header of all known non-finalized blocks in the chain without any specific
248248
/// order.
249-
pub fn iter_unordered(&self) -> impl Iterator<Item = header::HeaderRef> {
249+
pub fn iter_unordered(&'_ self) -> impl Iterator<Item = header::HeaderRef<'_>> {
250250
self.blocks
251251
.iter_unordered()
252252
.map(move |(_, b)| header::decode(&b.header, self.block_number_bytes).unwrap())
@@ -256,7 +256,7 @@ impl<T> NonFinalizedTree<T> {
256256
///
257257
/// The returned items are guaranteed to be in an order in which the parents are found before
258258
/// their children.
259-
pub fn iter_ancestry_order(&self) -> impl Iterator<Item = header::HeaderRef> {
259+
pub fn iter_ancestry_order(&'_ self) -> impl Iterator<Item = header::HeaderRef<'_>> {
260260
self.blocks
261261
.iter_ancestry_order()
262262
.map(move |(_, b)| header::decode(&b.header, self.block_number_bytes).unwrap())
@@ -281,7 +281,7 @@ impl<T> NonFinalizedTree<T> {
281281

282282
/// Builds a [`chain_information::ChainInformationRef`] struct that might later be used to
283283
/// build a new [`NonFinalizedTree`].
284-
pub fn as_chain_information(&self) -> chain_information::ValidChainInformationRef {
284+
pub fn as_chain_information(&'_ self) -> chain_information::ValidChainInformationRef<'_> {
285285
let attempt = chain_information::ChainInformationRef {
286286
finalized_block_header: header::decode(
287287
&self.finalized_block_header,
@@ -376,7 +376,7 @@ impl<T> NonFinalizedTree<T> {
376376
}
377377

378378
/// Returns consensus information about the current best block of the chain.
379-
pub fn best_block_consensus(&self) -> chain_information::ChainInformationConsensusRef {
379+
pub fn best_block_consensus(&'_ self) -> chain_information::ChainInformationConsensusRef<'_> {
380380
match (
381381
&self.finalized_consensus,
382382
self.blocks_by_best_score

lib/src/chain/blocks_tree/finality.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ impl<T> NonFinalizedTree<T> {
7171
/// verification is nonetheless deterministic.
7272
// TODO: expand the documentation about how blocks with authorities changes have to be finalized before any further block can be finalized
7373
pub fn verify_justification(
74-
&mut self,
74+
&'_ mut self,
7575
consensus_engine_id: [u8; 4],
7676
scale_encoded_justification: &[u8],
7777
randomness_seed: [u8; 32],
78-
) -> Result<FinalityApply<T>, JustificationVerifyError> {
78+
) -> Result<FinalityApply<'_, T>, JustificationVerifyError> {
7979
match (&self.finality, &consensus_engine_id) {
8080
(Finality::Grandpa { .. }, b"FRNK") => {
8181
// Turn justification into a strongly-typed struct.
@@ -121,10 +121,10 @@ impl<T> NonFinalizedTree<T> {
121121
/// A randomness seed must be provided and will be used during the verification. Note that the
122122
/// verification is nonetheless deterministic.
123123
pub fn verify_grandpa_commit_message(
124-
&mut self,
124+
&'_ mut self,
125125
scale_encoded_commit: &[u8],
126126
randomness_seed: [u8; 32],
127-
) -> Result<FinalityApply<T>, CommitVerifyError> {
127+
) -> Result<FinalityApply<'_, T>, CommitVerifyError> {
128128
// The code below would panic if the chain doesn't use Grandpa.
129129
if !matches!(self.finality, Finality::Grandpa { .. }) {
130130
return Err(CommitVerifyError::NotGrandpa);
@@ -202,9 +202,9 @@ impl<T> NonFinalizedTree<T> {
202202
/// If necessary, the current best block will be updated to be a descendant of the
203203
/// newly-finalized block.
204204
pub fn set_finalized_block(
205-
&mut self,
205+
&'_ mut self,
206206
block_hash: &[u8; 32],
207-
) -> Result<SetFinalizedBlockIter<T>, SetFinalizedError> {
207+
) -> Result<SetFinalizedBlockIter<'_, T>, SetFinalizedError> {
208208
let block_index = match self.blocks_by_hash.get(block_hash) {
209209
Some(idx) => *idx,
210210
None => return Err(SetFinalizedError::UnknownBlock),
@@ -311,9 +311,9 @@ impl<T> NonFinalizedTree<T> {
311311
/// Panics if `block_index_to_finalize` isn't a valid node in the tree.
312312
///
313313
fn set_finalized_block_inner(
314-
&mut self,
314+
&'_ mut self,
315315
block_index_to_finalize: fork_tree::NodeIndex,
316-
) -> SetFinalizedBlockIter<T> {
316+
) -> SetFinalizedBlockIter<'_, T> {
317317
let new_finalized_block = self.blocks.get_mut(block_index_to_finalize).unwrap();
318318

319319
// Update `self.finality`.

lib/src/chain/chain_information.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl From<ValidChainInformation> for ChainInformation {
6161

6262
impl ValidChainInformation {
6363
/// Gives access to the information.
64-
pub fn as_ref(&self) -> ChainInformationRef {
64+
pub fn as_ref(&'_ self) -> ChainInformationRef<'_> {
6565
From::from(&self.inner)
6666
}
6767
}

lib/src/chain/fork_tree.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl<T> ForkTree<T> {
259259
///
260260
/// Panics if the [`NodeIndex`] is invalid.
261261
///
262-
pub fn prune_ancestors(&mut self, node_index: NodeIndex) -> PruneAncestorsIter<T> {
262+
pub fn prune_ancestors(&'_ mut self, node_index: NodeIndex) -> PruneAncestorsIter<'_, T> {
263263
self.prune_ancestors_inner(node_index, false)
264264
}
265265

@@ -274,15 +274,15 @@ impl<T> ForkTree<T> {
274274
///
275275
/// Panics if the [`NodeIndex`] is invalid.
276276
///
277-
pub fn prune_uncles(&mut self, node_index: NodeIndex) -> PruneAncestorsIter<T> {
277+
pub fn prune_uncles(&'_ mut self, node_index: NodeIndex) -> PruneAncestorsIter<'_, T> {
278278
self.prune_ancestors_inner(node_index, true)
279279
}
280280

281281
fn prune_ancestors_inner(
282-
&mut self,
282+
&'_ mut self,
283283
node_index: NodeIndex,
284284
uncles_only: bool,
285-
) -> PruneAncestorsIter<T> {
285+
) -> PruneAncestorsIter<'_, T> {
286286
let iter = self.first_root.unwrap();
287287

288288
// `first_root` is updated ahead of the removal of the nodes. The update strategy is as

0 commit comments

Comments
 (0)