Preliminary Changes for Updating Cargo (#32547)
This commit is contained in:
parent
952d8861c6
commit
a7eda70ddb
|
@ -318,7 +318,7 @@ impl<T: AbiExample> AbiExample for Box<[T]> {
|
||||||
impl<T: AbiExample> AbiExample for std::marker::PhantomData<T> {
|
impl<T: AbiExample> AbiExample for std::marker::PhantomData<T> {
|
||||||
fn example() -> Self {
|
fn example() -> Self {
|
||||||
info!("AbiExample for (PhantomData<T>): {}", type_name::<Self>());
|
info!("AbiExample for (PhantomData<T>): {}", type_name::<Self>());
|
||||||
<std::marker::PhantomData<T>>::default()
|
std::marker::PhantomData::<T>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -620,7 +620,7 @@ mod tests {
|
||||||
let address = IpAddr::from([
|
let address = IpAddr::from([
|
||||||
525u16, 524u16, 523u16, 522u16, 521u16, 520u16, 519u16, 518u16,
|
525u16, 524u16, 523u16, 522u16, 521u16, 520u16, 519u16, 518u16,
|
||||||
]);
|
]);
|
||||||
let mut data = vec![0u8; IP_ECHO_SERVER_RESPONSE_LENGTH];
|
let mut data = [0u8; IP_ECHO_SERVER_RESPONSE_LENGTH];
|
||||||
bincode::serialize_into(&mut data[HEADER_LENGTH..], &address).unwrap();
|
bincode::serialize_into(&mut data[HEADER_LENGTH..], &address).unwrap();
|
||||||
let response: Result<IpEchoServerResponse, _> =
|
let response: Result<IpEchoServerResponse, _> =
|
||||||
bincode::deserialize(&data[HEADER_LENGTH..]);
|
bincode::deserialize(&data[HEADER_LENGTH..]);
|
||||||
|
|
|
@ -857,8 +857,8 @@ mod tests {
|
||||||
let mut cache = LoadedPrograms::default();
|
let mut cache = LoadedPrograms::default();
|
||||||
|
|
||||||
let program1 = Pubkey::new_unique();
|
let program1 = Pubkey::new_unique();
|
||||||
let program1_deployment_slots = vec![0, 10, 20];
|
let program1_deployment_slots = [0, 10, 20];
|
||||||
let program1_usage_counters = vec![4, 5, 25];
|
let program1_usage_counters = [4, 5, 25];
|
||||||
program1_deployment_slots
|
program1_deployment_slots
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -891,8 +891,8 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
let program2 = Pubkey::new_unique();
|
let program2 = Pubkey::new_unique();
|
||||||
let program2_deployment_slots = vec![5, 11];
|
let program2_deployment_slots = [5, 11];
|
||||||
let program2_usage_counters = vec![0, 2];
|
let program2_usage_counters = [0, 2];
|
||||||
program2_deployment_slots
|
program2_deployment_slots
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -924,8 +924,8 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
let program3 = Pubkey::new_unique();
|
let program3 = Pubkey::new_unique();
|
||||||
let program3_deployment_slots = vec![0, 5, 15];
|
let program3_deployment_slots = [0, 5, 15];
|
||||||
let program3_usage_counters = vec![100, 3, 20];
|
let program3_usage_counters = [100, 3, 20];
|
||||||
program3_deployment_slots
|
program3_deployment_slots
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
|
|
@ -426,6 +426,11 @@ pub fn derive_clone_zeroed(input: proc_macro::TokenStream) -> proc_macro::TokenS
|
||||||
let name = &item_struct.ident;
|
let name = &item_struct.ident;
|
||||||
quote! {
|
quote! {
|
||||||
impl Clone for #name {
|
impl Clone for #name {
|
||||||
|
// Clippy lint `incorrect_clone_impl_on_copy_type` requires that clone
|
||||||
|
// implementations on `Copy` types are simply wrappers of `Copy`.
|
||||||
|
// This is not the case here, and intentionally so because we want to
|
||||||
|
// guarantee zeroed padding.
|
||||||
|
#[allow(clippy::incorrect_clone_impl_on_copy_type)]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
let mut value = std::mem::MaybeUninit::<Self>::uninit();
|
let mut value = std::mem::MaybeUninit::<Self>::uninit();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -378,7 +378,7 @@ mod test {
|
||||||
fn test_bump_allocator() {
|
fn test_bump_allocator() {
|
||||||
// alloc the entire
|
// alloc the entire
|
||||||
{
|
{
|
||||||
let heap = vec![0u8; 128];
|
let heap = [0u8; 128];
|
||||||
let allocator = BumpAllocator {
|
let allocator = BumpAllocator {
|
||||||
start: heap.as_ptr() as *const _ as usize,
|
start: heap.as_ptr() as *const _ as usize,
|
||||||
len: heap.len(),
|
len: heap.len(),
|
||||||
|
@ -398,7 +398,7 @@ mod test {
|
||||||
}
|
}
|
||||||
// check alignment
|
// check alignment
|
||||||
{
|
{
|
||||||
let heap = vec![0u8; 128];
|
let heap = [0u8; 128];
|
||||||
let allocator = BumpAllocator {
|
let allocator = BumpAllocator {
|
||||||
start: heap.as_ptr() as *const _ as usize,
|
start: heap.as_ptr() as *const _ as usize,
|
||||||
len: heap.len(),
|
len: heap.len(),
|
||||||
|
@ -423,7 +423,7 @@ mod test {
|
||||||
}
|
}
|
||||||
// alloc entire block (minus the pos ptr)
|
// alloc entire block (minus the pos ptr)
|
||||||
{
|
{
|
||||||
let heap = vec![0u8; 128];
|
let heap = [0u8; 128];
|
||||||
let allocator = BumpAllocator {
|
let allocator = BumpAllocator {
|
||||||
start: heap.as_ptr() as *const _ as usize,
|
start: heap.as_ptr() as *const _ as usize,
|
||||||
len: heap.len(),
|
len: heap.len(),
|
||||||
|
|
|
@ -533,7 +533,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_try_drain_keys_found_in_lookup_table() {
|
fn test_try_drain_keys_found_in_lookup_table() {
|
||||||
let orig_keys = vec![
|
let orig_keys = [
|
||||||
Pubkey::new_unique(),
|
Pubkey::new_unique(),
|
||||||
Pubkey::new_unique(),
|
Pubkey::new_unique(),
|
||||||
Pubkey::new_unique(),
|
Pubkey::new_unique(),
|
||||||
|
@ -598,7 +598,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_try_drain_keys_found_in_lookup_table_with_empty_table() {
|
fn test_try_drain_keys_found_in_lookup_table_with_empty_table() {
|
||||||
let original_keys = vec![
|
let original_keys = [
|
||||||
Pubkey::new_unique(),
|
Pubkey::new_unique(),
|
||||||
Pubkey::new_unique(),
|
Pubkey::new_unique(),
|
||||||
Pubkey::new_unique(),
|
Pubkey::new_unique(),
|
||||||
|
|
|
@ -92,7 +92,6 @@ pub struct BorrowedInstruction<'a> {
|
||||||
#[cfg(not(target_os = "solana"))]
|
#[cfg(not(target_os = "solana"))]
|
||||||
bitflags! {
|
bitflags! {
|
||||||
struct InstructionsSysvarAccountMeta: u8 {
|
struct InstructionsSysvarAccountMeta: u8 {
|
||||||
const NONE = 0b00000000;
|
|
||||||
const IS_SIGNER = 0b00000001;
|
const IS_SIGNER = 0b00000001;
|
||||||
const IS_WRITABLE = 0b00000010;
|
const IS_WRITABLE = 0b00000010;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,7 @@ fn serialize_instructions(instructions: &[BorrowedInstruction]) -> Vec<u8> {
|
||||||
data[start..start + 2].copy_from_slice(&start_instruction_offset.to_le_bytes());
|
data[start..start + 2].copy_from_slice(&start_instruction_offset.to_le_bytes());
|
||||||
append_u16(&mut data, instruction.accounts.len() as u16);
|
append_u16(&mut data, instruction.accounts.len() as u16);
|
||||||
for account_meta in &instruction.accounts {
|
for account_meta in &instruction.accounts {
|
||||||
let mut account_meta_flags = InstructionsSysvarAccountMeta::NONE;
|
let mut account_meta_flags = InstructionsSysvarAccountMeta::empty();
|
||||||
if account_meta.is_signer {
|
if account_meta.is_signer {
|
||||||
account_meta_flags |= InstructionsSysvarAccountMeta::IS_SIGNER;
|
account_meta_flags |= InstructionsSysvarAccountMeta::IS_SIGNER;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue