@@ -6,44 +6,42 @@ The tracking issue for this feature is [#13231]
6
6
7
7
----
8
8
9
- The ` optin_builtin_traits ` feature gate allows you to define _ auto traits _ .
9
+ The ` optin_builtin_traits ` feature gate allows you to define auto traits .
10
10
11
11
Auto traits, like [ ` Send ` ] or [ ` Sync ` ] in the standard library, are marker traits
12
12
that are automatically implemented for every type, unless the type, or a type it contains,
13
- has explictly opted out via a _ negative impl _ .
13
+ has explictly opted out via a negative impl .
14
14
15
15
[ `Send` ] : https://doc.rust-lang.org/std/marker/trait.Send.html
16
16
[ `Sync` ] : https://doc.rust-lang.org/std/marker/trait.Sync.html
17
17
18
- ``` rust, ignore
18
+ ``` rust,ignore
19
19
impl !Type for Trait
20
20
```
21
21
22
22
Example:
23
23
24
24
``` rust
25
- #![feature(optin_builtin_traits)]
25
+ #![feature(optin_builtin_traits)]
26
26
27
- trait Valid {}
27
+ trait Valid {}
28
28
29
- impl Valid for .. {}
29
+ impl Valid for .. {}
30
30
31
- struct True ;
32
- struct False ;
31
+ struct True ;
32
+ struct False ;
33
33
34
- impl ! Valid for False {}
34
+ impl ! Valid for False {}
35
35
36
- struct MaybeValid <T >(T );
36
+ struct MaybeValid <T >(T );
37
37
38
- fn must_be_valid <T : Valid >(_t : T ) {
38
+ fn must_be_valid <T : Valid >(_t : T ) { }
39
39
40
- }
41
-
42
- fn main () {
43
- // works
44
- must_be_valid ( MaybeValid (True ) );
40
+ fn main () {
41
+ // works
42
+ must_be_valid ( MaybeValid (True ) );
45
43
46
- // compiler error - trait bound not satisfied
47
- // must_be_valid( MaybeValid(False) );
48
- }
44
+ // compiler error - trait bound not satisfied
45
+ // must_be_valid( MaybeValid(False) );
46
+ }
49
47
```
0 commit comments