summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-05-20 12:08:28 -0400
committerCorey Farwell <coreyf@rwell.org>2017-05-20 12:08:28 -0400
commit2d3438d35f8db4de0326f56232169b0bdbd6051c (patch)
tree13903e508fac87cc9d7458b39ee37fec3da8c738
parentd1f499309979fb53f4fa6d791cbfac803431579d (diff)
downloadrust-frewsxcv/unstable-book.tar.gz
Add basic Unstable Book entry for `attr_literals`.frewsxcv/unstable-book
-rw-r--r--src/doc/unstable-book/src/language-features/attr-literals.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/attr-literals.md b/src/doc/unstable-book/src/language-features/attr-literals.md
index 67eee214a4f..60741a74400 100644
--- a/src/doc/unstable-book/src/language-features/attr-literals.md
+++ b/src/doc/unstable-book/src/language-features/attr-literals.md
@@ -6,5 +6,25 @@ The tracking issue for this feature is: [#34981]
------------------------
+At present, literals are only accepted as the value of a key-value pair in
+attributes. What's more, only _string_ literals are accepted. This means that
+literals can only appear in forms of `#[attr(name = "value")]` or
+`#[attr = "value"]`.
+The `attr_literals` unstable feature allows other types of literals to be used
+in attributes. Here are some examples of attributes that can now be used with
+this feature enabled:
+
++```rust,ignore
++#[attr]
++#[attr(true)]
++#[attr(ident)]
++#[attr(ident, 100, true, "true", ident = 100, ident = "hello", ident(100))]
++#[attr(100)]
++#[attr(enabled = true)]
++#[enabled(true)]
++#[attr("hello")]
++#[repr(C, align = 4)]
++#[repr(C, align(4))]
++```