about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Midgley <chris.midgley@dunecomputers.co.uk>2021-07-21 10:29:20 +0100
committerChris Midgley <chris.midgley@dunecomputers.co.uk>2021-07-21 10:29:20 +0100
commite09d78260908436e6bc1691f23cda2ee8382545a (patch)
tree59e12fd63347de34d472f23ba963d8c4a75af87c
parent320d049e876579cd5c57be17e791a519f9b852a0 (diff)
downloadrust-e09d78260908436e6bc1691f23cda2ee8382545a.tar.gz
rust-e09d78260908436e6bc1691f23cda2ee8382545a.zip
add working code example
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0722.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0722.md b/compiler/rustc_error_codes/src/error_codes/E0722.md
index 4a687d74288..1513c4ce059 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0722.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0722.md
@@ -19,6 +19,16 @@ The `#[optimize]` attribute should be used as follows:
 - `#[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() {}
+
+fn main() {}
+```
+
 See [RFC 2412] for more details.
 
 [RFC 2412]: https://rust-lang.github.io/rfcs/2412-optimize-attr.html