You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/attributes/codegen.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,49 @@ r[attributes.codegen.inline]
9
9
r[attributes.codegen.inline.intro]
10
10
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.
11
11
12
+
> [!EXAMPLE]
13
+
> ```rust
14
+
> #[inline]
15
+
> pubfnexample1() {}
16
+
>
17
+
> #[inline(always)]
18
+
> pubfnexample2() {}
19
+
>
20
+
> #[inline(never)]
21
+
> pubfnexample3() {}
22
+
> ```
23
+
12
24
> [!NOTE]
13
25
> The `rustc` compilerautomaticallyinlinesfunctionsbasedoninternalheuristics.Incorrectlyinliningfunctionscanmaketheprogramslower, sothisattributeshouldbeusedwithcare.
0 commit comments