File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
doc/unstable-book/src/language-features Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 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+ ```
Original file line number Diff line number Diff line change 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) ) ]
You can’t perform that action at this time.
0 commit comments