Skip to content

Fix typo in unsize docs #1843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/traits/unsize.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ Specifically, the upcasting algorithm involves: For each supertrait of the
source dyn trait's principal (including itself)...
1. Unify the super trait ref with the principal of the target (making sure
we only ever upcast to a true supertrait, and never [via an impl]).
2. For every auto trait in the source, check that it's present in the principal
2. For every auto trait in the target, check that it's present in the source
(allowing us to drop auto traits, but never gain new ones).
3. For every projection in the source, check that it unifies with a single
projection in the target (since there may be more than one given
3. For every projection in the target, check that it unifies with a single
projection in the source (since there may be more than one given
`trait Sub: Sup<.., A = i32> + Sup<.., A = u32>`).

[via an impl]: https://github.com/rust-lang/rust/blob/f3457dbf84cd86d284454d12705861398ece76c3/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs#L19

Specifically, (3.) prevents a choice of projection bound to guide inference
unnecessarily, though it may guide inference when it is unambiguous.

[^1]: The principal is the one non-auto trait of a `dyn Trait`.
[^1]: The principal is the one non-auto trait of a `dyn Trait`.