Add long explanation for E0722
This commit is contained in:
24
compiler/rustc_error_codes/src/error_codes/E0722.md
Normal file
24
compiler/rustc_error_codes/src/error_codes/E0722.md
Normal file
@@ -0,0 +1,24 @@
|
||||
The `optimize` attribute was malformed.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0722
|
||||
#![feature(optimize_attribute)]
|
||||
|
||||
#[optimize(something)] // error: invalid argument
|
||||
pub fn something() {}
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
The `#[optimize]` attribute should be used as follows:
|
||||
|
||||
- `#[optimize(size)]` -- instructs the optimization pipeline to generate code
|
||||
that's smaller rather than faster
|
||||
|
||||
- `#[optimize(speed)]` -- instructs the optimization pipeline to generate code
|
||||
that's faster rather than smaller
|
||||
|
||||
See [RFC 2412] for more details.
|
||||
|
||||
[RFC 2412]: https://rust-lang.github.io/rfcs/2412-optimize-attr.html
|
||||
Reference in New Issue
Block a user