Skip to content

Add unconditional #[inline] to layout helper functions#3483

Merged
joshlf merged 2 commits into
mainfrom
codex/add-unconditional-#-inline]-annotations
Jul 8, 2026
Merged

Add unconditional #[inline] to layout helper functions#3483
joshlf merged 2 commits into
mainfrom
codex/add-unconditional-#-inline]-annotations

Conversation

@joshlf

@joshlf joshlf commented Jul 8, 2026

Copy link
Copy Markdown
Member

Motivation

  • Recent changes added conditional inline(always) annotations behind zerocopy_inline_always; adding an unconditional #[inline] ensures a baseline inline hint is present regardless of that config.
  • This keeps performance intent explicit for small layout helper functions across builds where the conditional flag is not enabled.

Description

  • Add #[inline] to SizeInfo::try_to_nonzero_elem_size in zerocopy/src/layout.rs so it appears alongside #[cfg_attr(zerocopy_inline_always, inline(always))].
  • Add #[inline] to padding_needed_for in zerocopy/src/util/mod.rs so it appears alongside #[cfg_attr(zerocopy_inline_always, inline(always))].
  • Add #[inline] to max and min in zerocopy/src/util/mod.rs so each appears alongside #[cfg_attr(zerocopy_inline_always, inline(always))].
  • No other logic or signatures were changed; only attribute annotations were added.

Testing

  • Ran CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN=1 ./cargo.sh +stable fmt --check and it completed successfully.
  • Ran git diff --check and it reported no issues.

Codex Task

@joshlf joshlf enabled auto-merge July 8, 2026 18:26
@joshlf joshlf requested a review from jswrenn July 8, 2026 18:26
@codecov-commenter

codecov-commenter commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.85%. Comparing base (fbe9f18) to head (efbf239).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3483   +/-   ##
=======================================
  Coverage   91.85%   91.85%           
=======================================
  Files          20       20           
  Lines        6093     6093           
=======================================
  Hits         5597     5597           
  Misses        496      496           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joshlf joshlf added this pull request to the merge queue Jul 8, 2026
Merged via the queue into main with commit 0f7c0bd Jul 8, 2026
128 checks passed
@joshlf joshlf deleted the codex/add-unconditional-#-inline]-annotations branch July 8, 2026 21:01
@joshlf

joshlf commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@ojeda This has been published in 0.8.54.

@ojeda

ojeda commented Jul 8, 2026

Copy link
Copy Markdown

Thanks! That was quick.

Linked in our live list as usual. I can probably land this one this kernel cycle too, i.e. not just v0.8.52.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants