]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0722.md
docs: revert removal of `E0729`
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0722.md
1 The `optimize` attribute was malformed.
2
3 Erroneous code example:
4
5 ```compile_fail,E0722
6 #![feature(optimize_attribute)]
7
8 #[optimize(something)] // error: invalid argument
9 pub fn something() {}
10 ```
11
12 The `#[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
20 For example:
21
22 ```
23 #![feature(optimize_attribute)]
24
25 #[optimize(size)]
26 pub fn something() {}
27 ```
28
29 See [RFC 2412] for more details.
30
31 [RFC 2412]: https://rust-lang.github.io/rfcs/2412-optimize-attr.html