Skip to content

Commit 80afb2e

Browse files
committed
Add rule about meaning of inline with async
On lang, we had earlier made a decision about how `inline` should apply to `async fn`. Let's document that here.
1 parent 0f9d592 commit 80afb2e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/attributes/codegen.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ The `inline` attribute supports these modes:
7474
r[attributes.codegen.inline.trait]
7575
When `inline` is applied to a function in a [trait], it applies only to the code of the [default definition].
7676
77+
r[attributes.codegen.inline.async]
78+
When `inline` is applied to an [async function] or [async closure], it applies only to the code of the generated `poll` function.
79+
80+
> [!NOTE]
81+
> For more details, see [Rust issue #129347](https://github.com/rust-lang/rust/issues/129347).
82+
7783
r[attributes.codegen.inline.externally-exported]
7884
The `inline` attribute is ignored if the function is externally exported with [`no_mangle`] or [`export_name`].
7985
@@ -764,6 +770,8 @@ If the address of the function is taken as a function pointer, the low bit of th
764770
[`unused_variables`]: ../../rustc/lints/listing/warn-by-default.html#unused-variables
765771
[associated functions]: items.associated.fn
766772
[async blocks]: expr.block.async
773+
[async closure]: expr.closure.async
774+
[async function]: items.fn.async
767775
[attribute]: ../attributes.md
768776
[attributes]: ../attributes.md
769777
[bodies]: items.fn.body

0 commit comments

Comments
 (0)