Skip to content

Commit 060016e

Browse files
authored
rust: 1.77.0 (#10856)
Release notes: https://blog.rust-lang.org/2024/03/21/Rust-1.77.0.html With split_last_chunk bunch of stdx code can now be deleted. \o/ As for other changes: - Rust now doesn’t consider Clone and Debug derives as using fields of a type. This lead to a handful of dead_code warnings. I’ve fixed them by either removing offending type or adding `allow(dead_code)`. - Cargo package id format has been stabilised¹ and krates crate stopped working. Why do we care about that crate? It’s a dependency of cargo-deny. To have CI pass I’ve updated taiki-e/install-action so that it fetches the newest cargo-deny. ¹ rust-lang/cargo#12914
1 parent 73b8827 commit 060016e

File tree

15 files changed

+48
-98
lines changed

15 files changed

+48
-98
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- uses: actions/checkout@v4
5555

5656
# Install all the required tools
57-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
57+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
5858
with:
5959
tool: just,cargo-nextest,cargo-llvm-cov
6060

@@ -107,7 +107,7 @@ jobs:
107107
with:
108108
python-version: 3.11
109109
cache: pip
110-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
110+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
111111
with:
112112
tool: cargo-llvm-cov
113113
- run: pip3 install --user -r pytest/requirements.txt
@@ -133,7 +133,7 @@ jobs:
133133
with:
134134
python-version: 3.11
135135
cache: pip
136-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
136+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
137137
with:
138138
tool: cargo-llvm-cov
139139
- run: pip3 install --user -r pytest/requirements.txt
@@ -163,7 +163,7 @@ jobs:
163163
with:
164164
python-version: 3.11
165165
cache: pip
166-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
166+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
167167
with:
168168
tool: cargo-llvm-cov
169169
- run: pip3 install --user -r pytest/requirements.txt
@@ -195,7 +195,7 @@ jobs:
195195
with:
196196
python-version: 3.11
197197
cache: pip
198-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
198+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
199199
with:
200200
tool: cargo-llvm-cov
201201
- run: pip3 install --user -r pytest/requirements.txt
@@ -217,7 +217,7 @@ jobs:
217217
runs-on: ubuntu-latest
218218
steps:
219219
- uses: actions/checkout@v4
220-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
220+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
221221
with:
222222
tool: just
223223
- uses: actions/setup-python@v4
@@ -236,7 +236,7 @@ jobs:
236236
with:
237237
python-version: 3.11
238238
cache: pip
239-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
239+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
240240
with:
241241
tool: cargo-llvm-cov
242242
- run: pip3 install --user -r pytest/requirements.txt
@@ -258,7 +258,7 @@ jobs:
258258
runs-on: ubuntu-latest
259259
steps:
260260
- uses: actions/checkout@v4
261-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
261+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
262262
with:
263263
tool: just
264264
- run: just check-rpc-errors-schema
@@ -277,7 +277,7 @@ jobs:
277277
runs-on: ubuntu-latest
278278
steps:
279279
- uses: actions/checkout@v4
280-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
280+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
281281
with:
282282
tool: just
283283
- run: just check-cargo-fmt
@@ -287,7 +287,7 @@ jobs:
287287
runs-on: ubuntu-22.04-8core
288288
steps:
289289
- uses: actions/checkout@v4
290-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
290+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
291291
with:
292292
tool: just
293293
- run: just check-cargo-clippy
@@ -297,7 +297,7 @@ jobs:
297297
runs-on: ubuntu-22.04-8core
298298
steps:
299299
- uses: actions/checkout@v4
300-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
300+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
301301
with:
302302
tool: just
303303
- run: just doctests
@@ -307,7 +307,7 @@ jobs:
307307
runs-on: ubuntu-latest
308308
steps:
309309
- uses: actions/checkout@v4
310-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
310+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
311311
with:
312312
tool: just,cargo-deny
313313
- run: just check-cargo-deny
@@ -317,7 +317,7 @@ jobs:
317317
runs-on: ubuntu-latest
318318
steps:
319319
- uses: actions/checkout@v4
320-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
320+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
321321
with:
322322
tool: just
323323
- run: just check-themis
@@ -327,7 +327,7 @@ jobs:
327327
runs-on: ubuntu-latest
328328
steps:
329329
- uses: actions/checkout@v4
330-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
330+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
331331
with:
332332
tool: just
333333
- run: just check-non-default
@@ -337,7 +337,7 @@ jobs:
337337
runs-on: ubuntu-22.04-8core
338338
steps:
339339
- uses: actions/checkout@v4
340-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
340+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
341341
with:
342342
tool: just,cargo-udeps
343343
- run: just check-cargo-udeps
@@ -347,7 +347,7 @@ jobs:
347347
runs-on: ubuntu-latest
348348
steps:
349349
- uses: actions/checkout@v4
350-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
350+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
351351
with:
352352
tool: cargo-audit
353353
- run: cargo audit -D warnings
@@ -373,7 +373,7 @@ jobs:
373373
with:
374374
name: coverage-profraw
375375
path: coverage/profraw
376-
- uses: taiki-e/install-action@91af8c38814c3998cb755869e5cbeffd3ab0e462
376+
- uses: taiki-e/install-action@9b5b983efc779f85e5e5d11539f005e85ccb27ff
377377
with:
378378
tool: cargo-llvm-cov
379379
- uses: actions/setup-python@v4

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version = "0.0.0" # managed by cargo-workspaces, see below
33
authors = ["Near Inc <[email protected]>"]
44
edition = "2021"
5-
rust-version = "1.76.0"
5+
rust-version = "1.77.0"
66
repository = "https://github.com/near/nearcore"
77
license = "MIT OR Apache-2.0"
88

chain/chain/src/store.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,8 +2772,7 @@ mod tests {
27722772
let mut chain = get_chain(Clock::real());
27732773
let genesis = chain.get_block_by_height(0).unwrap();
27742774
let signer = Arc::new(create_test_signer("test1"));
2775-
let short_fork =
2776-
vec![TestBlockBuilder::new(Clock::real(), &genesis, signer.clone()).build()];
2775+
let short_fork = [TestBlockBuilder::new(Clock::real(), &genesis, signer.clone()).build()];
27772776
let mut store_update = chain.mut_chain_store().store_update();
27782777
store_update.save_block_header(short_fork[0].header().clone()).unwrap();
27792778
store_update.commit().unwrap();

chain/chain/src/tests/garbage_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ fn test_fork_far_away_from_epoch_end() {
601601
let max_changes = 1;
602602
let fork_clean_step = 100;
603603
let epoch_length = fork_clean_step + 10;
604-
let simple_chains = vec![
604+
let simple_chains = [
605605
SimpleChain { from: 0, length: 5, is_removed: false },
606606
SimpleChain { from: 5, length: 2, is_removed: true },
607607
// We want the chain to end up exactly at the new epoch start.

chain/client/src/adapter.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,6 @@ use crate::view_client::ViewClientActor;
33
use near_async::actix::AddrWithAutoSpanContextExt;
44
use near_async::messaging::IntoSender;
55
use near_network::client::ClientSenderForNetwork;
6-
use near_network::types::{
7-
PartialEncodedChunkForwardMsg, PartialEncodedChunkRequestMsg, PartialEncodedChunkResponseMsg,
8-
};
9-
use near_primitives::hash::CryptoHash;
10-
use near_primitives::sharding::PartialEncodedChunk;
11-
12-
#[derive(actix::Message, Debug)]
13-
#[rtype(result = "()")]
14-
pub(crate) struct RecvPartialEncodedChunkForward(pub PartialEncodedChunkForwardMsg);
15-
16-
#[derive(actix::Message, Debug)]
17-
#[rtype(result = "()")]
18-
pub(crate) struct RecvPartialEncodedChunk(pub PartialEncodedChunk);
19-
20-
#[derive(actix::Message, Debug)]
21-
#[rtype(result = "()")]
22-
pub(crate) struct RecvPartialEncodedChunkResponse(
23-
pub PartialEncodedChunkResponseMsg,
24-
pub std::time::Instant,
25-
);
26-
27-
#[derive(actix::Message, Debug)]
28-
#[rtype(result = "()")]
29-
pub(crate) struct RecvPartialEncodedChunkRequest(pub PartialEncodedChunkRequestMsg, pub CryptoHash);
306

317
pub fn client_sender_for_network(
328
client_addr: actix::Addr<ClientActor>,

chain/client/src/sync/external.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ impl ExternalConnection {
151151
if let Some(parent_dir) = path.parent() {
152152
std::fs::create_dir_all(parent_dir)?;
153153
}
154-
let mut file = std::fs::OpenOptions::new().write(true).create(true).open(&path)?;
154+
let mut file = std::fs::OpenOptions::new()
155+
.write(true)
156+
.create(true)
157+
.truncate(true)
158+
.open(&path)?;
155159
file.write_all(data)?;
156160
tracing::debug!(target: "state_sync_dump", shard_id, part_length = data.len(), ?location, ?file_type, "Wrote a state part to a file");
157161
Ok(())

chain/epoch-manager/src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,7 @@ fn test_protocol_version_switch_with_shard_layout_change() {
22962296
}
22972297
epoch_manager.record_block_info(block_info, [0; 32]).unwrap();
22982298
}
2299-
let epochs = vec![EpochId::default(), EpochId(h[2]), EpochId(h[4])];
2299+
let epochs = [EpochId::default(), EpochId(h[2]), EpochId(h[4])];
23002300
assert_eq!(
23012301
epoch_manager.get_epoch_info(&epochs[1]).unwrap().protocol_version(),
23022302
new_protocol_version - 1

chain/network/src/network_protocol/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn deduplicate_edges() {
2424
let bc1 = data::make_edge(&b, &c, 1);
2525
let mut want = vec![ab5.clone(), ac9.clone(), bc1.clone()];
2626
want.sort_by_key(|e| e.key().clone());
27-
let input = vec![ab1, ab3, ab5, ac7, ac9, bc1];
27+
let input = [ab1, ab3, ab5, ac7, ac9, bc1];
2828
for p in input.iter().permutations(input.len()) {
2929
let mut got = Edge::deduplicate(p.into_iter().cloned().collect());
3030
got.sort_by_key(|e| e.key().clone());

chain/network/src/peer/peer_actor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,7 @@ impl actix::Handler<WithSpanContext<Stop>> for PeerActor {
17951795
type InboundHandshakePermit = tokio::sync::OwnedSemaphorePermit;
17961796

17971797
#[derive(Debug)]
1798+
#[allow(dead_code)]
17981799
enum ConnectingStatus {
17991800
Inbound(InboundHandshakePermit),
18001801
Outbound { _permit: connection::OutboundHandshakePermit, handshake_spec: HandshakeSpec },
@@ -1813,6 +1814,7 @@ enum ConnectingStatus {
18131814
/// For the exact process of establishing a connection between peers,
18141815
/// see PoolSnapshot in chain/network/src/peer_manager/connection.rs.
18151816
#[derive(Debug)]
1817+
#[allow(dead_code)]
18161818
enum PeerStatus {
18171819
/// Handshake in progress.
18181820
Connecting(HandshakeSignalSender, ConnectingStatus),

core/crypto/src/key_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl KeyFile {
2626
#[cfg(unix)]
2727
fn create(path: &Path) -> io::Result<File> {
2828
use std::os::unix::fs::OpenOptionsExt;
29-
std::fs::File::options().mode(0o600).write(true).create(true).open(path)
29+
std::fs::File::options().mode(0o600).write(true).create(true).truncate(true).open(path)
3030
}
3131

3232
#[cfg(not(unix))]

0 commit comments

Comments
 (0)