diff options
| author | bors <bors@rust-lang.org> | 2018-08-18 19:34:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-18 19:34:24 +0000 |
| commit | 33b923fd44c5c5925e635815fce68bdf1f98740f (patch) | |
| tree | f10fd762a6fde5ed03bdc2b2ff9c9b9cda6382cd /src/doc | |
| parent | f0341412ed4b7c39003f2bf409b183d7ce066814 (diff) | |
| parent | 4e7d3f5a5eb9db95194cbb672f081c2ad9647674 (diff) | |
| download | rust-33b923fd44c5c5925e635815fce68bdf1f98740f.tar.gz rust-33b923fd44c5c5925e635815fce68bdf1f98740f.zip | |
Auto merge of #53324 - alexreg:self_in_typedefs, r=eddyb
`Self` in type definitions (self_in_typedefs) This implements the [`self_in_typedefs` feature](https://github.com/rust-lang/rfcs/blob/master/text/2300-self-in-typedefs.md) ([tracking issue 49303](https://github.com/rust-lang/rust/issues/49303)). r? @eddyb CC @Centril
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/self-in-typedefs.md | 24 |
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 +} +``` |
