From 4e7d3f5a5eb9db95194cbb672f081c2ad9647674 Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Tue, 14 Aug 2018 21:26:33 +0100 Subject: [PATCH] Added page for feature to unstable book. --- .../src/language-features/self-in-typedefs.md | 24 +++++++++++++++++++ src/librustc_resolve/lib.rs | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/doc/unstable-book/src/language-features/self-in-typedefs.md 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 +where + Self: PartialOrd // can write `Self` instead of `List` +{ + Nil, + Cons(T, Box) // 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))]