]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_error_codes/src/error_codes/E0722.md
New upstream version 1.55.0+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0722.md
CommitLineData
136023e0
XL
1The `optimize` attribute was malformed.
2
3Erroneous code example:
4
5```compile_fail,E0722
6#![feature(optimize_attribute)]
7
8#[optimize(something)] // error: invalid argument
9pub fn something() {}
10```
11
12The `#[optimize]` attribute should be used as follows:
13
14- `#[optimize(size)]` -- instructs the optimization pipeline to generate code
15 that's smaller rather than faster
16
17- `#[optimize(speed)]` -- instructs the optimization pipeline to generate code
18 that's faster rather than smaller
19
20For example:
21
22```
23#![feature(optimize_attribute)]
24
25#[optimize(size)]
26pub fn something() {}
27```
28
29See [RFC 2412] for more details.
30
31[RFC 2412]: https://rust-lang.github.io/rfcs/2412-optimize-attr.html