Skip to content

Commit ec0f998

Browse files
committed
improve solve/candidate-preference.md
1 parent df96b2d commit ec0f998

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/solve/candidate-preference.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ where
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

7979
We 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
8181
errors if the where-bound results in region constraints to avoid incompleteness.
8282
```rust
8383
trait Super {
@@ -98,15 +98,15 @@ where
9898
fn 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

106106
This preference causes a lot of issues.
107107
See [#24066].
108108
Most 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
111111
trait Trait<T> {
112112
fn call_me(&self, x: T) {}
@@ -180,8 +180,8 @@ where
180180

181181
Global where-bounds are either fully implied by an impl or unsatisfiable.
182182
If 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
187187
trait 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.
199199
There are no known issues from preferring impls over global where-bounds.
200200

201201
#### Why still consider global where-bounds

0 commit comments

Comments
 (0)