Skip to content

Commit

Permalink
Added page for feature to unstable book.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Regueiro committed Aug 18, 2018
1 parent 7920a65 commit 4e7d3f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/doc/unstable-book/src/language-features/self-in-typedefs.md
Original file line number Diff line number Diff line change
@@ -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
}
```
4 changes: 2 additions & 2 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down

0 comments on commit 4e7d3f5

Please sign in to comment.