-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #87321 - midgleyc:add-E0722-long, r=GuillaumeGomez
Add long explanation for E0722 Helps with #61137
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
The `optimize` attribute was malformed. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0722 | ||
#![feature(optimize_attribute)] | ||
#[optimize(something)] // error: invalid argument | ||
pub fn something() {} | ||
``` | ||
|
||
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 | ||
|
||
For example: | ||
|
||
``` | ||
#![feature(optimize_attribute)] | ||
#[optimize(size)] | ||
pub fn something() {} | ||
``` | ||
|
||
See [RFC 2412] for more details. | ||
|
||
[RFC 2412]: https://rust-lang.github.io/rfcs/2412-optimize-attr.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters