Added page for feature to unstable book.
This commit is contained in:
parent
7920a65c5f
commit
4e7d3f5a5e
@ -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
|
||||
}
|
||||
```
|
@ -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))]
|
||||
|
Loading…
Reference in New Issue
Block a user