File tree 2 files changed +26
-2
lines changed
doc/unstable-book/src/language-features
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 9
9
// except according to those terms.
10
10
11
11
#![ 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/" ) ]
14
14
15
15
#![ feature( crate_visibility_modifier) ]
16
16
#![ cfg_attr( not( stage0) , feature( nll) ) ]
You can’t perform that action at this time.
0 commit comments