You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/traits/unsize.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -70,15 +70,16 @@ Specifically, the upcasting algorithm involves: For each supertrait of the
70
70
source dyn trait's principal (including itself)...
71
71
1. Unify the super trait ref with the principal of the target (making sure
72
72
we only ever upcast to a true supertrait, and never [via an impl]).
73
-
2. For every auto trait in the source, check that it's present in the principal
73
+
2. For every auto trait in the target, check that it's present in the source
74
74
(allowing us to drop auto traits, but never gain new ones).
75
-
3. For every projection in the source, check that it unifies with a single
76
-
projection in the target (since there may be more than one given
75
+
3. For every projection in the target, check that it unifies with a single
76
+
projection in the source (since there may be more than one given
77
77
`trait Sub: Sup<.., A = i32> + Sup<.., A = u32>`).
78
78
79
79
[via an impl]: https://github.com/rust-lang/rust/blob/f3457dbf84cd86d284454d12705861398ece76c3/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs#L19
80
80
81
81
Specifically, (3.) prevents a choice of projection bound to guide inference
82
82
unnecessarily, though it may guide inference when it is unambiguous.
83
83
84
-
[^1]: The principal is the one non-auto trait of a `dyn Trait`.
84
+
[^1]: The principal is the one non-auto trait of a `dyn Trait`.
0 commit comments