Repository navigation
Make inline attributes apply to the generated poll in async fn - #149245
Conversation
|
rustbot has assigned @JonathanBrouwer. Use |
This comment has been minimized.
This comment has been minimized.
46d6c3e to
d89022a
Compare
This comment has been minimized.
This comment has been minimized.
9478bfd to
fa35f7b
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
☔ The latest upstream changes (presumably #149853) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts. |
|
Triage: Are you still working on this @xacrimon? |
fa35f7b to
7054408
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
⌛ Testing commit 2caedab with merge a28b383... Workflow: https://github.com/rust-lang/rust/actions/runs/41634166848 |
…hlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes #129347 and fixes #106765.
This has already been FCP'ed here: #129347
…ttr, r=saethlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes rust-lang#129347 and fixes rust-lang#106765.
This has already been FCP'ed here: rust-lang#129347
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #165403. |
…uwer Rollup of 13 pull requests Successful merges: - #149245 (Make inline attributes apply to the generated `poll` in async fn) - #164304 ([perf] Reuse CanonicalVarKinds if no new variables were added) - #165109 (Avoid building a region map when erasing bound regions) - #163393 (std: Use getexecpath() for current_exe() on OpenBSD) - #165358 (Reenable some cg_gcc tests that were disabled) - #165371 (Don't use `llvm_type` as the type of `static`s.) - #162232 (Replace `builtin #` with `k#`) - #162608 (Avoid oscillating line wrapping due to symbol indices) - #164241 (make the safety documentation consistent in Ptr module) - #165029 (Use `MalformedLintAttributeInput` in more places) - #165203 (AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test) - #165230 (Fix rigidity assertion ICE) - #165374 (Refactorings in preparation for the move trait)
|
⌛ Testing commit 2caedab with merge 5413e35... Workflow: https://github.com/rust-lang/rust/actions/runs/41650433730 |
…hlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes #129347 and fixes #106765.
This has already been FCP'ed here: #129347
|
(Sorry, yielding to rustfmt subtree sync since we need to get a sync done for a release.) |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #165378. |
…ttr, r=saethlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes rust-lang#129347 and fixes rust-lang#106765.
This has already been FCP'ed here: rust-lang#129347
…uwer Rollup of 20 pull requests Successful merges: - #149245 (Make inline attributes apply to the generated `poll` in async fn) - #163495 (Parallelize AST -> HIR lowering) - #164304 ([perf] Reuse CanonicalVarKinds if no new variables were added) - #165109 (Avoid building a region map when erasing bound regions) - #163393 (std: Use getexecpath() for current_exe() on OpenBSD) - #163625 (Add a lint helper attribute namespace ) - #164414 (Add `let_underscore_drop_guard` lint.) - #165342 (Avoid unnecessary MIR traversals in CheckPackedRef lint) - #165351 (delegation: insert probing adjustments before args check adjustments) - #165358 (Reenable some cg_gcc tests that were disabled) - #165377 (Make `no_implicit_prelude` not suppress tool attributes) - #165397 (Add codegen test for unused match arms removed after inlining) - #165398 (Rework parallel reproducibility tests) - #162608 (Avoid oscillating line wrapping due to symbol indices) - #164241 (make the safety documentation consistent in Ptr module) - #165029 (Use `MalformedLintAttributeInput` in more places) - #165203 (AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test) - #165230 (Fix rigidity assertion ICE) - #165293 (unstable-book: update default-visibility.md to link to tracking issue) - #165374 (Refactorings in preparation for the move trait)
…ttr, r=saethlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes rust-lang#129347 and fixes rust-lang#106765.
This has already been FCP'ed here: rust-lang#129347
…uwer Rollup of 21 pull requests Successful merges: - #165416 (fix unsoundness when compiling `[diverging_const; 0]`) - #149245 (Make inline attributes apply to the generated `poll` in async fn) - #163495 (Parallelize AST -> HIR lowering) - #164304 ([perf] Reuse CanonicalVarKinds if no new variables were added) - #165109 (Avoid building a region map when erasing bound regions) - #163393 (std: Use getexecpath() for current_exe() on OpenBSD) - #163625 (Add a lint helper attribute namespace ) - #164414 (Add `let_underscore_drop_guard` lint.) - #165342 (Avoid unnecessary MIR traversals in CheckPackedRef lint) - #165351 (delegation: insert probing adjustments before args check adjustments) - #165358 (Reenable some cg_gcc tests that were disabled) - #165377 (Make `no_implicit_prelude` not suppress tool attributes) - #165397 (Add codegen test for unused match arms removed after inlining) - #165398 (Rework parallel reproducibility tests) - #162608 (Avoid oscillating line wrapping due to symbol indices) - #164241 (make the safety documentation consistent in Ptr module) - #165029 (Use `MalformedLintAttributeInput` in more places) - #165203 (AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test) - #165230 (Fix rigidity assertion ICE) - #165293 (unstable-book: update default-visibility.md to link to tracking issue) - #165374 (Refactorings in preparation for the move trait)
…ttr, r=saethlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes rust-lang#129347 and fixes rust-lang#106765.
This has already been FCP'ed here: rust-lang#129347
…hlin
Make inline attributes apply to the generated `poll` in async fn
This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.
Code like the following now correctly codegen 3 functions
- `async_fn_test::consumer`
- `async_fn_test::hi::{closure#0}`
- `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>`
```rust
#[inline(never)]
pub async fn hi() -> i32 {
1337
}
pub fn consumer(cx: &mut Context<'_>) -> Option<i32> {
let fut = hi();
let pinned = pin!(fut);
match pinned.poll(cx) {
Poll::Ready(value) => Some(value),
Poll::Pending => None,
}
}
```
Fixes #129347 and fixes #106765.
This has already been FCP'ed here: #129347
|
⌛ Testing commit 2caedab with merge 5900293... Workflow: https://github.com/rust-lang/rust/actions/runs/41697174656 |
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #165426. |
…uwer Rollup of 20 pull requests Successful merges: - #149245 (Make inline attributes apply to the generated `poll` in async fn) - #163495 (Parallelize AST -> HIR lowering) - #164304 ([perf] Reuse CanonicalVarKinds if no new variables were added) - #165109 (Avoid building a region map when erasing bound regions) - #163393 (std: Use getexecpath() for current_exe() on OpenBSD) - #163625 (Add a lint helper attribute namespace ) - #164414 (Add `let_underscore_drop_guard` lint.) - #165342 (Avoid unnecessary MIR traversals in CheckPackedRef lint) - #165351 (delegation: insert probing adjustments before args check adjustments) - #165358 (Reenable some cg_gcc tests that were disabled) - #165377 (Make `no_implicit_prelude` not suppress tool attributes) - #165397 (Add codegen test for unused match arms removed after inlining) - #165398 (Rework parallel reproducibility tests) - #162608 (Avoid oscillating line wrapping due to symbol indices) - #164241 (make the safety documentation consistent in Ptr module) - #165029 (Use `MalformedLintAttributeInput` in more places) - #165203 (AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test) - #165230 (Fix rigidity assertion ICE) - #165293 (unstable-book: update default-visibility.md to link to tracking issue) - #165374 (Refactorings in preparation for the move trait)
…uwer Rollup of 22 pull requests Successful merges: - #149245 (Make inline attributes apply to the generated `poll` in async fn) - #164304 ([perf] Reuse CanonicalVarKinds if no new variables were added) - #165109 (Avoid building a region map when erasing bound regions) - #163393 (std: Use getexecpath() for current_exe() on OpenBSD) - #163625 (Add a lint helper attribute namespace ) - #164414 (Add `let_underscore_drop_guard` lint.) - #165342 (Avoid unnecessary MIR traversals in CheckPackedRef lint) - #165351 (delegation: insert probing adjustments before args check adjustments) - #165358 (Reenable some cg_gcc tests that were disabled) - #165377 (Make `no_implicit_prelude` not suppress tool attributes) - #165397 (Add codegen test for unused match arms removed after inlining) - #165398 (Rework parallel reproducibility tests) - #162232 (Replace `builtin #` with `k#`) - #162608 (Avoid oscillating line wrapping due to symbol indices) - #164241 (make the safety documentation consistent in Ptr module) - #164258 (clarify when `Vec::into_boxed_slice()` is in-place) - #165029 (Use `MalformedLintAttributeInput` in more places) - #165203 (AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test) - #165230 (Fix rigidity assertion ICE) - #165293 (unstable-book: update default-visibility.md to link to tracking issue) - #165374 (Refactorings in preparation for the move trait) - #165421 (another Enzyme submodule update for nested autodiff)
Rollup merge of #149245 - xacrimon:acrimon/async-fn-inline-attr, r=saethlin Make inline attributes apply to the generated `poll` in async fn This PR adds lowering code (similar to how track_caller forwarding works) to `async fn` items and `async ||` closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to the `poll()` implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue. Code like the following now correctly codegen 3 functions - `async_fn_test::consumer` - `async_fn_test::hi::{closure#0}` - `core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>` ```rust #[inline(never)] pub async fn hi() -> i32 { 1337 } pub fn consumer(cx: &mut Context<'_>) -> Option<i32> { let fut = hi(); let pinned = pin!(fut); match pinned.poll(cx) { Poll::Ready(value) => Some(value), Poll::Pending => None, } } ``` Fixes #129347 and fixes #106765. This has already been FCP'ed here: #129347
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (8fc1145): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Artifact size: 406.38 MiB -> 406.44 MiB (0.01%) |
…uwer Rollup of 22 pull requests Successful merges: - rust-lang/rust#149245 (Make inline attributes apply to the generated `poll` in async fn) - rust-lang/rust#164304 ([perf] Reuse CanonicalVarKinds if no new variables were added) - rust-lang/rust#165109 (Avoid building a region map when erasing bound regions) - rust-lang/rust#163393 (std: Use getexecpath() for current_exe() on OpenBSD) - rust-lang/rust#163625 (Add a lint helper attribute namespace ) - rust-lang/rust#164414 (Add `let_underscore_drop_guard` lint.) - rust-lang/rust#165342 (Avoid unnecessary MIR traversals in CheckPackedRef lint) - rust-lang/rust#165351 (delegation: insert probing adjustments before args check adjustments) - rust-lang/rust#165358 (Reenable some cg_gcc tests that were disabled) - rust-lang/rust#165377 (Make `no_implicit_prelude` not suppress tool attributes) - rust-lang/rust#165397 (Add codegen test for unused match arms removed after inlining) - rust-lang/rust#165398 (Rework parallel reproducibility tests) - rust-lang/rust#162232 (Replace `builtin #` with `k#`) - rust-lang/rust#162608 (Avoid oscillating line wrapping due to symbol indices) - rust-lang/rust#164241 (make the safety documentation consistent in Ptr module) - rust-lang/rust#164258 (clarify when `Vec::into_boxed_slice()` is in-place) - rust-lang/rust#165029 (Use `MalformedLintAttributeInput` in more places) - rust-lang/rust#165203 (AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test) - rust-lang/rust#165230 (Fix rigidity assertion ICE) - rust-lang/rust#165293 (unstable-book: update default-visibility.md to link to tracking issue) - rust-lang/rust#165374 (Refactorings in preparation for the move trait) - rust-lang/rust#165421 (another Enzyme submodule update for nested autodiff)
View all comments
This PR adds lowering code (similar to how track_caller forwarding works) to
async fnitems andasync ||closures such that any inline attributes put on them are inherited by the generated coroutine (corresponding to thepoll()implementation) and are not applied to the outer function. This behavior matches the accepted FCP in the first linked issue.Code like the following now correctly codegen 3 functions
async_fn_test::consumerasync_fn_test::hi::{closure#0}core::ptr::drop_in_place::<async_fn_test::hi::{closure#0}>Fixes #129347 and fixes #106765.
This has already been FCP'ed here: #129347