Preliminary Changes for Updating Cargo (#32547)

This commit is contained in:
Andrew Fitzgerald 2023-07-21 13:43:00 -07:00 committed by GitHub
parent 952d8861c6
commit a7eda70ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 15 deletions

View File

@ -318,7 +318,7 @@ impl<T: AbiExample> AbiExample for Box<[T]> {
impl<T: AbiExample> AbiExample for std::marker::PhantomData<T> {
fn example() -> Self {
info!("AbiExample for (PhantomData<T>): {}", type_name::<Self>());
<std::marker::PhantomData<T>>::default()
std::marker::PhantomData::<T>
}
}

View File

@ -620,7 +620,7 @@ mod tests {
let address = IpAddr::from([
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();
let response: Result<IpEchoServerResponse, _> =
bincode::deserialize(&data[HEADER_LENGTH..]);

View File

@ -857,8 +857,8 @@ mod tests {
let mut cache = LoadedPrograms::default();
let program1 = Pubkey::new_unique();
let program1_deployment_slots = vec![0, 10, 20];
let program1_usage_counters = vec![4, 5, 25];
let program1_deployment_slots = [0, 10, 20];
let program1_usage_counters = [4, 5, 25];
program1_deployment_slots
.iter()
.enumerate()
@ -891,8 +891,8 @@ mod tests {
}
let program2 = Pubkey::new_unique();
let program2_deployment_slots = vec![5, 11];
let program2_usage_counters = vec![0, 2];
let program2_deployment_slots = [5, 11];
let program2_usage_counters = [0, 2];
program2_deployment_slots
.iter()
.enumerate()
@ -924,8 +924,8 @@ mod tests {
}
let program3 = Pubkey::new_unique();
let program3_deployment_slots = vec![0, 5, 15];
let program3_usage_counters = vec![100, 3, 20];
let program3_deployment_slots = [0, 5, 15];
let program3_usage_counters = [100, 3, 20];
program3_deployment_slots
.iter()
.enumerate()

View File

@ -426,6 +426,11 @@ pub fn derive_clone_zeroed(input: proc_macro::TokenStream) -> proc_macro::TokenS
let name = &item_struct.ident;
quote! {
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 {
let mut value = std::mem::MaybeUninit::<Self>::uninit();
unsafe {

View File

@ -378,7 +378,7 @@ mod test {
fn test_bump_allocator() {
// alloc the entire
{
let heap = vec![0u8; 128];
let heap = [0u8; 128];
let allocator = BumpAllocator {
start: heap.as_ptr() as *const _ as usize,
len: heap.len(),
@ -398,7 +398,7 @@ mod test {
}
// check alignment
{
let heap = vec![0u8; 128];
let heap = [0u8; 128];
let allocator = BumpAllocator {
start: heap.as_ptr() as *const _ as usize,
len: heap.len(),
@ -423,7 +423,7 @@ mod test {
}
// alloc entire block (minus the pos ptr)
{
let heap = vec![0u8; 128];
let heap = [0u8; 128];
let allocator = BumpAllocator {
start: heap.as_ptr() as *const _ as usize,
len: heap.len(),

View File

@ -533,7 +533,7 @@ mod tests {
#[test]
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(),
@ -598,7 +598,7 @@ mod tests {
#[test]
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(),

View File

@ -92,7 +92,6 @@ pub struct BorrowedInstruction<'a> {
#[cfg(not(target_os = "solana"))]
bitflags! {
struct InstructionsSysvarAccountMeta: u8 {
const NONE = 0b00000000;
const IS_SIGNER = 0b00000001;
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());
append_u16(&mut data, instruction.accounts.len() as u16);
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 {
account_meta_flags |= InstructionsSysvarAccountMeta::IS_SIGNER;
}