3232{
3333 // Elaborating the `&'a str: Trait<T>` where-bound results in a
3434 // `&'a str: Sized` where-bound. We do not want to prefer this
35- // over the builtin impl.
35+ // over the builtin impl.
3636 is_sized (x );
3737}
3838```
@@ -77,7 +77,7 @@ fn foo<'a, T: Trait<'a>>() {
7777```
7878
7979We also need this as shadowed impls can result in currently ambiguous solver cycles: [ trait-system-refactor-initiative #76 ] .
80- Without preference we'd be forced to fail with ambiguity
80+ Without preference, we'd be forced to fail with ambiguity
8181errors if the where-bound results in region constraints to avoid incompleteness.
8282``` rust
8383trait Super {
@@ -98,15 +98,15 @@ where
9898fn overflow <T : Trait >() {
9999 // We can use the elaborated `Super<SuperAssoc = Self::TraitAssoc>` where-bound
100100 // to prove the where-bound of the `T: Trait` implementation. This currently results in
101- // overflow.
101+ // overflow.
102102 let x : <T as Trait >:: TraitAssoc ;
103103}
104104```
105105
106106This preference causes a lot of issues.
107107See [ #24066 ] .
108108Most of the
109- issues are caused by preferring where-bounds over impls even if the where-bound guides type inference:
109+ issues are caused by preferring where-bounds over impls even, if the where-bound guides type inference:
110110``` rust
111111trait Trait <T > {
112112 fn call_me (& self , x : T ) {}
@@ -180,8 +180,8 @@ where
180180
181181Global where-bounds are either fully implied by an impl or unsatisfiable.
182182If they are unsatisfiable, we don't really care what happens.
183- If a where-bound is fully implied then using the impl to prove the trait goal cannot result in additional constraints.
184- For trait goals this is only useful for where-bounds which use ` 'static ` :
183+ If a where-bound is fully implied, then using the impl to prove the trait goal cannot result in additional constraints.
184+ For trait goals, this is only useful for where-bounds which use ` 'static ` :
185185
186186``` rust
187187trait A {
@@ -195,7 +195,7 @@ where
195195 x . test ();
196196}
197197```
198- More importantly, by using impls here we prevent global where-bounds from shadowing impls when normalizing associated types.
198+ More importantly, by using impls here, we prevent global where-bounds from shadowing impls when normalizing associated types.
199199There are no known issues from preferring impls over global where-bounds.
200200
201201#### Why still consider global where-bounds
0 commit comments