diff options
| author | Alexander Regueiro <alexreg@me.com> | 2018-08-14 21:26:33 +0100 |
|---|---|---|
| committer | Alexander Regueiro <alexreg@me.com> | 2018-08-18 18:56:31 +0100 |
| commit | 4e7d3f5a5eb9db95194cbb672f081c2ad9647674 (patch) | |
| tree | 4eafa375f54fc99cb1073f4c9e3f8305667d6084 | |
| parent | 7920a65c5ff8bde8a80b0c350de949c39b3a407d (diff) | |
| download | rust-4e7d3f5a5eb9db95194cbb672f081c2ad9647674.tar.gz rust-4e7d3f5a5eb9db95194cbb672f081c2ad9647674.zip | |
Added page for feature to unstable book.
| -rw-r--r-- | src/doc/unstable-book/src/language-features/self-in-typedefs.md | 24 | ||||
| -rw-r--r-- | src/librustc_resolve/lib.rs | 4 |
2 files changed, 26 insertions, 2 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 +} +``` diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index faf129eb836..5becf5034d9 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -9,8 +9,8 @@ // except according to those terms. #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", - html_favicon_url = "https://doc.rust-lang.org/favicon.ico", - html_root_url = "https://doc.rust-lang.org/nightly/")] + html_favicon_url = "https://doc.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(crate_visibility_modifier)] #![cfg_attr(not(stage0), feature(nll))] |
