]>
Commit | Line | Data |
---|---|---|
136023e0 XL |
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 |