Open
Description
I would expect the following code produced a Future::poll()
impl with the noinline
attribute.
#![feature(noop_waker)]
use std::task::{Context, Waker, Poll};
use std::future::Future;
#[inline(never)]
pub async fn foo() -> u32 {
std::hint::black_box(1)
}
pub fn bar() -> Poll<u32> {
let f = std::pin::pin!(foo());
f.poll(&mut Context::from_waker(Waker::noop()))
}
Instead, the poll method has inlinehint
applied to it and gets inlined accordingly:
; This is the function creating the async fn obj:
; Function Attrs: noinline nonlazybind uwtable
define i8 @_RNvCs8Nh0J9OTdDr_15async_fn_inline3foo() unnamed_addr #2 {
%1 = alloca [1 x i8], align 1
store i8 0, ptr %1, align 1
%2 = load i8, ptr %1, align 1
ret i8 %2
}
; This the poll method:
; Function Attrs: inlinehint nonlazybind uwtable <== this should arguably be noinline too
define internal { i32, i32 } @_RNCNvCs8Nh0J9OTdDr_15async_fn_inline3foo0B3_(...)
Meta
rustc --version --verbose
:
rustc 1.82.0-nightly (636d7ff91 2024-08-19)
binary: rustc
commit-hash: 636d7ff91b9847d6d43c7bbe023568828f6e3246
commit-date: 2024-08-19
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Async & AwaitArea: Code generationAsync-await issues that have been triaged during a working group meeting.Category: This is a bug.Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the language team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.