File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -434,9 +434,15 @@ type MyPhantomData<T: ?Sized> = MyPhantomData<T>;
434
434
which hides the implementation detail and drives focus to your handwritten
435
435
documentation to show how the type is intended to be used.
436
436
437
- The ` #[allow(type_alias_bounds)] ` is required because trait bounds on type
438
- parameters are not respected by the current compiler implementation so it warns
439
- about them, but Rustdoc does display them which we want in this case.
437
+ The ` #[allow(type_alias_bounds)] ` attribute suppresses a future compatibility
438
+ lint that triggers on type aliases with trait bounds on the left hand side. The
439
+ Rust compiler currently does not respect such bounds but this behavior is
440
+ considered a compiler bug and is subject to change, potentially breaking code
441
+ involving trait bounds in type aliases -- hence the lint. Our code above is in
442
+ the clear because the bounds in the type alias exactly match the bounds implied
443
+ by well-formedness of the right hand side, so the meaning is the same whether or
444
+ not the compiler looks at the type alias bounds. We want the bounds there
445
+ because they do appear correctly in Rustdoc.
440
446
441
447
<br >
442
448
You can’t perform that action at this time.
0 commit comments