Skip to content

Add documentation for the cold and track_caller attributes#158484

Open
valentynkit wants to merge 1 commit into
rust-lang:mainfrom
valentynkit:docs-cold-track-caller-attributes
Open

Add documentation for the cold and track_caller attributes#158484
valentynkit wants to merge 1 commit into
rust-lang:mainfrom
valentynkit:docs-cold-track-caller-attributes

Conversation

@valentynkit

@valentynkit valentynkit commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Adds cold and track_caller, the two code generation attributes left from my claim on the tracking issue.

Both stay guide-level, with one runnable example each. For track_caller I used a small assert-style helper, since the attribute mainly affects which line a panic points at. inline is already up in #158348.

Part of #157604

r? @GuillaumeGomez

Tested with ./x test library/std --doc --test-args attribute_docs.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 27, 2026
@rust-bors

This comment has been minimized.

Document the built-in `cold` and `track_caller` attributes in the standard
library using the `#[doc(attribute = "...")]` mechanism, following the
existing `must_use` and `inline` attribute documentation.
@valentynkit valentynkit force-pushed the docs-cold-track-caller-attributes branch from a5d8d3c to ea8581e Compare July 9, 2026 15:42
@rustbot

rustbot commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants