Skip to content

Commit 78f1d35

Browse files
joncinquefebo
authored andcommitted
Bump Rust to 1.88, nightly to 2025-06-29 (anza-xyz#210)
#### Problem Rust has been upgrading, but not the version used in the sdk repo. Also, with the upcoming breaking changes to the sdk, it's a good time to bump the rust edition to 2024, but we should upgrade to the newest Rust first. #### Summary of changes Bump the version in rust-toolchain.toml and scripts/rust-version.sh, then fix any issues reported.
1 parent fa088a9 commit 78f1d35

File tree

15 files changed

+21
-26
lines changed

15 files changed

+21
-26
lines changed

account-info/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,25 @@ impl<'a> AccountInfo<'a> {
106106
Ok(self.try_borrow_data()?.is_empty())
107107
}
108108

109-
pub fn try_borrow_lamports(&self) -> Result<Ref<&mut u64>, ProgramError> {
109+
pub fn try_borrow_lamports(&self) -> Result<Ref<'_, &mut u64>, ProgramError> {
110110
self.lamports
111111
.try_borrow()
112112
.map_err(|_| ProgramError::AccountBorrowFailed)
113113
}
114114

115-
pub fn try_borrow_mut_lamports(&self) -> Result<RefMut<&'a mut u64>, ProgramError> {
115+
pub fn try_borrow_mut_lamports(&self) -> Result<RefMut<'_, &'a mut u64>, ProgramError> {
116116
self.lamports
117117
.try_borrow_mut()
118118
.map_err(|_| ProgramError::AccountBorrowFailed)
119119
}
120120

121-
pub fn try_borrow_data(&self) -> Result<Ref<&mut [u8]>, ProgramError> {
121+
pub fn try_borrow_data(&self) -> Result<Ref<'_, &mut [u8]>, ProgramError> {
122122
self.data
123123
.try_borrow()
124124
.map_err(|_| ProgramError::AccountBorrowFailed)
125125
}
126126

127-
pub fn try_borrow_mut_data(&self) -> Result<RefMut<&'a mut [u8]>, ProgramError> {
127+
pub fn try_borrow_mut_data(&self) -> Result<RefMut<'_, &'a mut [u8]>, ProgramError> {
128128
self.data
129129
.try_borrow_mut()
130130
.map_err(|_| ProgramError::AccountBorrowFailed)

epoch-rewards-hasher/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ mod tests {
123123
// size is same or 1 less
124124
assert!(
125125
len == expected_len_of_partition || len + 1 == expected_len_of_partition,
126-
"{}, {}, {}, {}",
127-
expected_len_of_partition,
128-
len,
129-
partition,
130-
partitions
126+
"{expected_len_of_partition}, {len}, {partition}, {partitions}",
131127
);
132128
}
133129
}

hard-forks/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl HardForks {
2929
}
3030

3131
// Returns a sorted-by-slot iterator over the registered hark forks
32-
pub fn iter(&self) -> std::slice::Iter<(u64, usize)> {
32+
pub fn iter(&self) -> std::slice::Iter<'_, (u64, usize)> {
3333
self.hard_forks.iter()
3434
}
3535

instructions-sysvar/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ mod tests {
326326
is_writable: bool,
327327
}
328328

329-
fn make_borrowed_instruction(params: &MakeInstructionParams) -> BorrowedInstruction {
329+
fn make_borrowed_instruction(params: &MakeInstructionParams) -> BorrowedInstruction<'_> {
330330
let MakeInstructionParams {
331331
program_id,
332332
account_key,

keypair/src/signable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait Signable {
1717
}
1818

1919
fn pubkey(&self) -> Pubkey;
20-
fn signable_data(&self) -> Cow<[u8]>;
20+
fn signable_data(&self) -> Cow<'_, [u8]>;
2121
fn get_signature(&self) -> Signature;
2222
fn set_signature(&mut self, signature: Signature);
2323
}

message/src/compiled_keys.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ impl fmt::Display for CompileError {
3535
f.write_str("address lookup table index overflowed during compilation")
3636
}
3737
CompileError::UnknownInstructionKey(key) => f.write_fmt(format_args!(
38-
"encountered unknown account key `{0}` during instruction compilation",
39-
key,
38+
"encountered unknown account key `{key}` during instruction compilation",
4039
)),
4140
}
4241
}

message/src/sanitized.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl LegacyMessage<'_> {
6868
}
6969

7070
/// Returns the full list of account keys.
71-
pub fn account_keys(&self) -> AccountKeys {
71+
pub fn account_keys(&self) -> AccountKeys<'_> {
7272
AccountKeys::new(&self.message.account_keys, None)
7373
}
7474

@@ -197,7 +197,7 @@ impl SanitizedMessage {
197197
}
198198

199199
/// Returns the list of account keys that are loaded for this message.
200-
pub fn account_keys(&self) -> AccountKeys {
200+
pub fn account_keys(&self) -> AccountKeys<'_> {
201201
match self {
202202
Self::Legacy(message) => message.account_keys(),
203203
Self::V0(message) => message.account_keys(),
@@ -285,7 +285,7 @@ impl SanitizedMessage {
285285
}
286286

287287
/// Decompile message instructions without cloning account keys
288-
pub fn decompile_instructions(&self) -> Vec<BorrowedInstruction> {
288+
pub fn decompile_instructions(&self) -> Vec<BorrowedInstruction<'_>> {
289289
let account_keys = self.account_keys();
290290
self.program_instructions_iter()
291291
.map(|(program_id, instruction)| {

message/src/versions/v0/loaded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'a> LoadedMessage<'a> {
9898
}
9999

100100
/// Returns the full list of static and dynamic account keys that are loaded for this message.
101-
pub fn account_keys(&self) -> AccountKeys {
101+
pub fn account_keys(&self) -> AccountKeys<'_> {
102102
AccountKeys::new(&self.message.account_keys, Some(&self.loaded_addresses))
103103
}
104104

native-token/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn sol_str_to_lamports(sol_str: &str) -> Option<u64> {
3838
let lamports = if lamports.is_empty() {
3939
0
4040
} else {
41-
format!("{:0<9}", lamports)[..SOL_DECIMALS].parse().ok()?
41+
format!("{lamports:0<9}")[..SOL_DECIMALS].parse().ok()?
4242
};
4343
LAMPORTS_PER_SOL
4444
.checked_mul(sol)

program/src/program.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn check_type_assumptions() {
244244
assert_eq!(offset_of!(AccountInfo, data), 16);
245245
let data_ptr = (account_info_addr + 16) as *const Rc<RefCell<&mut [u8]>>;
246246
unsafe {
247-
assert_eq!((*(*data_ptr).as_ptr())[..], data[..]);
247+
assert_eq!((&(*(*data_ptr).as_ptr()))[..], data[..]);
248248
}
249249

250250
// owner

0 commit comments

Comments
 (0)