about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2018-08-14 21:26:33 +0100
committerAlexander Regueiro <alexreg@me.com>2018-08-18 18:56:31 +0100
commit4e7d3f5a5eb9db95194cbb672f081c2ad9647674 (patch)
tree4eafa375f54fc99cb1073f4c9e3f8305667d6084 /src/doc
parent7920a65c5ff8bde8a80b0c350de949c39b3a407d (diff)
downloadrust-4e7d3f5a5eb9db95194cbb672f081c2ad9647674.tar.gz
rust-4e7d3f5a5eb9db95194cbb672f081c2ad9647674.zip
Added page for feature to unstable book.
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/language-features/self-in-typedefs.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/self-in-typedefs.md b/src/doc/unstable-book/src/language-features/self-in-typedefs.md
new file mode 100644
index 00000000000..2416e85c17d
--- /dev/null
+++ b/src/doc/unstable-book/src/language-features/self-in-typedefs.md
@@ -0,0 +1,24 @@
+# `self_in_typedefs`
+
+The tracking issue for this feature is: [#49303]
+
+[#49303]: https://github.com/rust-lang/rust/issues/49303
+
+------------------------
+
+The `self_in_typedefs` feature gate lets you use the special `Self` identifier
+in `struct`, `enum`, and `union` type definitions.
+
+A simple example is:
+
+```rust
+#![feature(self_in_typedefs)]
+
+enum List<T>
+where
+    Self: PartialOrd<Self> // can write `Self` instead of `List<T>`
+{
+    Nil,
+    Cons(T, Box<Self>) // likewise here
+}
+```