Skip to content

Commit 09f455d

Browse files
authored
Merge pull request #4 from dtolnay/alias
Add detail about type_alias_bounds future compatibility lint
2 parents ecd6081 + 6e49e01 commit 09f455d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

unit-type-parameters/README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,15 @@ type MyPhantomData<T: ?Sized> = MyPhantomData<T>;
434434
which hides the implementation detail and drives focus to your handwritten
435435
documentation to show how the type is intended to be used.
436436

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.
440446

441447
<br>
442448

0 commit comments

Comments
 (0)