Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make trivial-copy-size-limit target independent #13319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Alexendoo
Copy link
Member

Fixes https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Ambiguous.20default.20value.20for.20.60trivial-copy-size-limit.60

The current situation is

Target width trivial-copy-size-limit
8-bit 2
16-bit 4
32-bit 8
64-bit 8

Since practically speaking it's almost always 8, let's go with that as the unconditional default to make it easier to understand

changelog: [trivial-copy-size-limit] now also defaults to 8 on 8-bit and 16-bit targets

@rustbot
Copy link
Collaborator

rustbot commented Aug 28, 2024

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 28, 2024
@Jarcho
Copy link
Contributor

Jarcho commented Aug 28, 2024

The original justification for limiting it to eight on 64-bit targets was quite flimsy. It makes (usize, usize) ok on everything but 64-bit targets. This means something like struct S(&'static [u8]) is too big to pass by value, which is rather ridiculous.

It would be nice if the lint could be target independent, but struct sizes already aren't.

@Alexendoo
Copy link
Member Author

This means something like struct S(&'static [u8]) is too big to pass by value

It means it's not small enough to lint, not that it's too big to pass by value. That's a separate config pass-by-value-size-limit

@Jarcho
Copy link
Contributor

Jarcho commented Aug 29, 2024

Sorry I had lint/not lint backwards (was half thinking of large_types_passed_by_value). &S would be trigger trivially_copy_pass_by_ref on 32-bit targets, but not on 64-bit targets. Basically fat pointers should behave consistently.

@bors
Copy link
Contributor

bors commented Oct 1, 2024

☔ The latest upstream changes (presumably #13286) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants