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
{{ message }}
Repository navigation
#[inline] is no longer accepted on closures #49632
I can make a change, since I wrote that original patch. I'm curious if a better change would be to have closures always inlined? That seems like it might have been the expected behavior and the reason why it was suggested to me to write the check like this in the first place?
I believe closures are currently always effectively #[inline]. However in some cases I need to force inlining with #[inline(always)] even when LLVM thinks it is a bad idea.
I would just change the check_expr_attributes function in librustc/hir/check_attr.rs to check the variant of hir::Expr passed in when the attribute is inline. if its ExprClosure then don't emit an error. But Id prefer to have someone who does the reviews say this is what they want instead of having a surprise at the pull request stage.
Activity
sanxiyn commentedon Apr 5, 2018
While I think this should be fixed, this is not exactly a regression, since
stmt_expr_attributesis unstable and this code never worked on stable.tejom commentedon Apr 6, 2018
I can make a change, since I wrote that original patch. I'm curious if a better change would be to have closures always inlined? That seems like it might have been the expected behavior and the reason why it was suggested to me to write the check like this in the first place?
Amanieu commentedon Apr 6, 2018
I believe closures are currently always effectively
#[inline]. However in some cases I need to force inlining with#[inline(always)]even when LLVM thinks it is a bad idea.tejom commentedon Apr 6, 2018
I would just change the
check_expr_attributesfunction in librustc/hir/check_attr.rs to check the variant ofhir::Exprpassed in when the attribute is inline. if itsExprClosurethen don't emit an error. But Id prefer to have someone who does the reviews say this is what they want instead of having a surprise at the pull request stage.Rollup merge of rust-lang#50273 - Amanieu:issue-49532, r=alexcrichton