File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
src/doc/unstable-book/src/language-features Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,22 @@ has explictly opted out via a negative impl.
19
19
impl !Type for Trait
20
20
```
21
21
22
+ [ #46108 ] added the ` DynSized ` trait, which is an implicit bound for all traits. Auto traits may not
23
+ have bounds, so you must explicitly remove this bound with ` ?DynSized ` . [ #44917 ] adds a ` Move ` trait
24
+ which is also implicit, so when that lands, you will have to add ` ?Move ` as well.
25
+
26
+ [ #46108 ] : https://github.com/rust-lang/rust/pull/46108
27
+ [ #44917 ] : https://github.com/rust-lang/rust/pull/44917
28
+
29
+
22
30
Example:
23
31
24
32
``` rust
25
- #![feature(optin_builtin_traits)]
33
+ #![feature(optin_builtin_traits, dynsized)]
34
+
35
+ use std :: marker :: DynSized ;
26
36
27
- auto trait Valid {}
37
+ auto trait Valid : ? DynSized {}
28
38
29
39
struct True ;
30
40
struct False ;
@@ -38,7 +48,6 @@ fn must_be_valid<T: Valid>(_t: T) { }
38
48
fn main () {
39
49
// works
40
50
must_be_valid ( MaybeValid (True ) );
41
-
42
51
// compiler error - trait bound not satisfied
43
52
// must_be_valid( MaybeValid(False) );
44
53
}
You can’t perform that action at this time.
0 commit comments