Ensure that optimize attributes on closures are inherited by the shim.#157802
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @mejrs rustbot has assigned @mejrs. Use Why was this reviewer chosen?The reviewer was selected based on:
|
I still want to review this as well. |
988502a to
e18fa55
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready (is there a way for me to re-trigger the CI for things that appear to be spurious failures like this one?) |
There was a problem hiding this comment.
What is the behavior of this?
#![feature(optimize_attribute)]
fn main() {
f(
#[optimize(size)] || { },
);
}
fn f(_: impl Fn()) {}Note that the attribute is applied to a function argument, not the expression (hence it does not require #![feature(stmt_expr_attributes)]).
|
(I just noticed there's a stabilization PR in flight, I have raised it there as well) |
In practice that's going to depend on inlining (i.e. if the closure gets MIR-inlined into |
|
I see. Attributes in that position are somewhat ambiguous so a test would be nice, if it is feasible.
You can force push nothing. |
e18fa55 to
0959e4d
Compare
I think I did so.
Good to know! |
|
@bors r=mejrs,wesleywiser rollup |
…mejrs,wesleywiser Ensure that optimize attributes on closures are inherited by the shim. Tracking issue: rust-lang#54882 Stabilization PR: rust-lang#157273
…mejrs,wesleywiser Ensure that optimize attributes on closures are inherited by the shim. Tracking issue: rust-lang#54882 Stabilization PR: rust-lang#157273
Rollup of 7 pull requests Successful merges: - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
…mejrs,wesleywiser Ensure that optimize attributes on closures are inherited by the shim. Tracking issue: rust-lang#54882 Stabilization PR: rust-lang#157273
Rollup of 9 pull requests Successful merges: - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157514 ([tiny] Use multipart suggestion for finding ident when literal was expected in attr) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
Rollup of 10 pull requests Successful merges: - #157714 (Improve polymorphization of raw pointer formatting) - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157594 (note which target a missing target_feature belongs to) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
Rollup of 10 pull requests Successful merges: - #157714 (Improve polymorphization of raw pointer formatting) - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157594 (note which target a missing target_feature belongs to) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
Tracking issue: #54882
Stabilization PR: #157273