Skip to content

Commit 986b500

Browse files
ehusstraviscross
authored andcommitted
Unwrap cold and inline
1 parent 3279c0e commit 986b500

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/attributes/codegen.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,16 @@ r[attributes.codegen.hint]
77
## Optimization hints
88

99
r[attributes.codegen.hint.cold-inline]
10-
The `cold` and `inline` [attributes] give suggestions to generate code in a
11-
way that may be faster than what it would do without the hint. The attributes
12-
are only hints, and may be ignored.
10+
The `cold` and `inline` [attributes] give suggestions to generate code in a way that may be faster than what it would do without the hint. The attributes are only hints, and may be ignored.
1311

1412
r[attributes.codegen.hint.usage]
15-
Both attributes can be used on [functions]. When applied to a function in a
16-
[trait], they apply only to that function when used as a default function for
17-
a trait implementation and not to all trait implementations. The attributes
18-
have no effect on a trait function without a body.
13+
Both attributes can be used on [functions]. When applied to a function in a [trait], they apply only to that function when used as a default function for a trait implementation and not to all trait implementations. The attributes have no effect on a trait function without a body.
1914

2015
r[attributes.codegen.inline]
2116
### The `inline` attribute
2217

2318
r[attributes.codegen.inline.intro]
24-
The *`inline` [attribute]* suggests that a copy of the attributed function
25-
should be placed in the caller, rather than generating code to call the
26-
function where it is defined.
19+
The *`inline` [attribute]* suggests that a copy of the attributed function should be placed in the caller, rather than generating code to call the function where it is defined.
2720

2821
> [!NOTE]
2922
> The `rustc` compiler automatically inlines functions based on internal heuristics. Incorrectly inlining functions can make the program slower, so this attribute should be used with care.
@@ -32,19 +25,16 @@ r[attributes.codegen.inline.modes]
3225
There are three ways to use the inline attribute:
3326

3427
* `#[inline]` *suggests* performing an inline expansion.
35-
* `#[inline(always)]` *suggests* that an inline expansion should always be
36-
performed.
37-
* `#[inline(never)]` *suggests* that an inline expansion should never be
38-
performed.
28+
* `#[inline(always)]` *suggests* that an inline expansion should always be performed.
29+
* `#[inline(never)]` *suggests* that an inline expansion should never be performed.
3930

4031
> [!NOTE]
4132
> `#[inline]` in every form is a hint, with no *requirements* on the language to place a copy of the attributed function in the caller.
4233
4334
r[attributes.codegen.cold]
4435
### The `cold` attribute
4536

46-
The *`cold` [attribute]* suggests that the attributed function is unlikely to
47-
be called.
37+
The *`cold` [attribute]* suggests that the attributed function is unlikely to be called.
4838

4939
r[attributes.codegen.naked]
5040
## The `naked` attribute

0 commit comments

Comments
 (0)