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
optimize attribute can be applied to anything #128488
A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.F-optimize_attribute`#![feature(optimize_attribute)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team
warning: attribute should be applied to function or closure
--> poc.rs:2:1
|
2 | #[optimize(cake, bar, foo, bop)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
It emits unused_attributes since that's what's specified in the RFC. Perhaps that should be amended to an error, which would be more consistent with other diagnostics like this
A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.F-optimize_attribute`#![feature(optimize_attribute)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team
Activity
clubby789 commentedon Aug 1, 2024
I think #128458 should have fixed this
clubby789 commentedon Aug 1, 2024
It emits
unused_attributessince that's what's specified in the RFC. Perhaps that should be amended to an error, which would be more consistent with other diagnostics like thisibilalkayy commentedon Aug 4, 2024
Is this issue still available to work on?
tnuha commentedon Aug 10, 2024
@rustbot claim
tnuha commentedon Aug 10, 2024
I'll be submitting a PR for this in case the RFC dictates errors in place of warnings, at least in this instance.
`optimize` attribute applied to things other than methods/functions/c…
`optimize` attribute applied to things other than methods/functions/c…
`optimize` attribute applied to things other than methods/functions/c…
misapplied optimize attribute throws a compilation error (rust-lang#1…
misapplied optimize attribute throws a compilation error (rust-lang#1…
Rollup merge of rust-lang#131814 - Borgerr:misapplied-optimize-attrib…
Unrolled build for rust-lang#131814
tnuha commentedon Aug 5, 2025
@rustbot release-assignment
oli-obk commentedon Aug 8, 2025
Fixed by #131814