-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#[inline(never)] does not work for async functions #129347
Comments
I feel like it's actually up for debate whether |
I agree that that's not clear. It would be great, however, if there was some way to control the inlining behavior of the poll function. |
I can agree about that! |
@rustbot labels +T-lang +I-lang-nominated We discussed this during WG-async triage. On the one hand, this is an optimization, so it seems like a compiler issue. But there's also a lang issue hiding in here: To what does the attribute apply? That's probably a lang question. So let's lang nominate it and discuss. Our feeling on the WG-async call was that the attribute should probably apply semantically to both the function that constructs the future and to the constructed And we felt that if people needed more control than that, the suggestion would be that they desugar the What does the team think? |
I said this in the meeting but this is an interesting question that is related to the "flavors" RFC I recently opened. I think it implies that This suggests that if you REALLY want control, you can desugar like so #[inline(always)]
async fn foo() -> T { ... }
// becomes
fn foo() -> async -> T {
#[inline(always)] // <-- this goes here
async move { ... }
} This implies you can add attributes on the |
@rfcbot cancel |
@traviscross proposal cancelled. |
@rfcbot fcp merge |
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
@rfcbot reviewed |
@rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
I'll note that that's the default, thanks to #116505, so from a lowering perspective nothing should be needed for that. Notable, it should not be @rfcbot reviewed |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
I would expect the following code produced a
Future::poll()
impl with thenoinline
attribute.Instead, the poll method has
inlinehint
applied to it and gets inlined accordingly:Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: