Skip to content

Fix clippy 1.85.0#3576

Merged
acheroncrypto merged 3 commits intosolana-foundation:masterfrom
acheroncrypto:fix-clippy-1.85.0
Mar 1, 2025
Merged

Fix clippy 1.85.0#3576
acheroncrypto merged 3 commits intosolana-foundation:masterfrom
acheroncrypto:fix-clippy-1.85.0

Conversation

@acheroncrypto
Copy link
Copy Markdown
Collaborator

Problem

CI tests fail due to the new clippy lints coming from the latest stable Rust release (v1.85.0).

Summary of changes

Fix clippy::repr_packed_without_abi.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 1, 2025

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added the fix Bug fix PR label Mar 1, 2025
}

#[account(zero_copy(unsafe))]
#[repr(C)]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the only reason to use zero_copy(unsafe) is to be able to use repr(packed). Shouldn't use that here to be more representative of real world usage?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, but zero_copy(unsafe) mostly exists for historical reasons (it was the initial impl and some older programs needed compatibility in newer versions) and you should generally avoid using repr(packed).

Additionally, this file doesn't represent real world usage, and in fact, it doesn't even work. This change was only aimed at fixing the clippy error in CI, so which repr(s) we use doesn't matter at all.

However, you're right; this may cause confusion, so I'll fix that. I initially wanted to avoid making codegen changes because those changes might delay the next release, but now that I think about this again, it's probably better to just change

https://github.com/coral-xyz/anchor/blob/4004c4e964ffa2399999e6fc900232df6d164f41/lang/attribute/account/src/lib.rs#L459

to repr(Rust, packed) to also fix this lint for downstream users.

@acheroncrypto acheroncrypto merged commit c869e11 into solana-foundation:master Mar 1, 2025
52 of 53 checks passed
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants