Skip to content

Commit 4e7d3f5

Browse files
author
Alexander Regueiro
committed
Added page for feature to unstable book.
1 parent 7920a65 commit 4e7d3f5

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# `self_in_typedefs`
2+
3+
The tracking issue for this feature is: [#49303]
4+
5+
[#49303]: https://github.com/rust-lang/rust/issues/49303
6+
7+
------------------------
8+
9+
The `self_in_typedefs` feature gate lets you use the special `Self` identifier
10+
in `struct`, `enum`, and `union` type definitions.
11+
12+
A simple example is:
13+
14+
```rust
15+
#![feature(self_in_typedefs)]
16+
17+
enum List<T>
18+
where
19+
Self: PartialOrd<Self> // can write `Self` instead of `List<T>`
20+
{
21+
Nil,
22+
Cons(T, Box<Self>) // likewise here
23+
}
24+
```

src/librustc_resolve/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
12-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
13-
html_root_url = "https://doc.rust-lang.org/nightly/")]
12+
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
13+
html_root_url = "https://doc.rust-lang.org/nightly/")]
1414

1515
#![feature(crate_visibility_modifier)]
1616
#![cfg_attr(not(stage0), feature(nll))]

0 commit comments

Comments
 (0)