Skip to content

Commit

Permalink
Fix typo in unsize docs (rust-lang#1843)
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors authored Dec 29, 2023
1 parent 038010b commit cb22c58
Showing 1 changed file with 5 additions and 4 deletions.
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`.

0 comments on commit cb22c58

Please sign in to comment.