rust-lang / rust-lang/reference

Documentation for #[inline] in the reference doesn't align with external resources

Open
#1,140 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

The current documentation for #[inline] places huge emphasis on its effect as an inlining hint. I was recently referred to the reference when I tried to inform another user that its primary effect is enabling cross-crate inlining of non-generic functions. I'm not sure if this lack of documentation is just an oversight (which I'm happy to correct with a PR) or if this is deliberate because the cross-crate inlining effect is planned to be removed, or if the hint is guaranteed, but the codegen difference isn't.

I'm particularly concerned, because this effect is well-known in resources outside of the reference:
https://matklad.github.io/2021/07/09/inline-in-rust.html
https://github.com/rust-lang/hashbrown/pull/119#issuecomment-537539046

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust Reference entry for #[inline] and compare its wording with the two external resources linked in the issue. Clarify whether cross-crate inlining of non-generic functions is an intended effect and how the inlining hint is guaranteed. Done means the reference accurately documents the agreed behavior; confirm the wording with maintainers before editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.