Skip to content

Commit 2b8f3d4

Browse files
mark-i-mscalexm
andcommitted
Fix typos and punctuation
Co-Authored-By: scalexm <[email protected]>
1 parent 2df0fcf commit 2b8f3d4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/traits/implied-bounds.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() {
4545
}
4646
```
4747

48-
hence we don't want to repeat where clauses for input types because that would
48+
Hence, we don't want to repeat where clauses for input types because that would
4949
sort of duplicate the work of the programmer, having to verify that their types
5050
are well-formed both when calling the function and when using them in the
5151
arguments of their function. The same reasoning applies when using an `impl`.
@@ -75,15 +75,15 @@ fn fun_with_copy<T: Copy>(x: T) {
7575
}
7676
```
7777

78-
The rationale for implied bounds for traits is that if a type implement `Copy`,
79-
that is if there exists an `impl Copy` for that type, there *ought* to exist
78+
The rationale for implied bounds for traits is that if a type implements `Copy`,
79+
that is, if there exists an `impl Copy` for that type, there *ought* to exist
8080
an `impl Clone` for that type, otherwise the compiler would have reported an
8181
error in the first place. So again, if we were forced to repeat the additionnal
8282
`where SomeType: Clone` everywhere whereas we already know that
8383
`SomeType: Copy` hold, we would kind of duplicate the verification work.
8484

8585
Implied bounds are not yet completely enforced in rustc, at the moment it only
86-
works for outlive requirements, super trait bounds and bounds on associated
86+
works for outlive requirements, super trait bounds, and bounds on associated
8787
types. The full RFC can be found [here][RFC]. We'll give here a brief view
8888
of how implied bounds work and why we chose to implement it that way. The
8989
complete set of lowering rules can be found in the corresponding
@@ -155,7 +155,7 @@ implied bounds from impls. Suppose we know that a type `SomeType<...>`
155155
implements `Bar` and we want to deduce that `SomeType<...>` must also implement
156156
`Foo`.
157157

158-
There are two possibilities: first one, we have enough information about
158+
There are two possibilities: first, we have enough information about
159159
`SomeType<...>` to see that there exists a `Bar` impl in the program which
160160
covers `SomeType<...>`, for example a plain `impl<...> Bar for SomeType<...>`.
161161
Then if the compiler has done its job correctly, there *must* exist a `Foo`
@@ -172,7 +172,7 @@ fn foo<T: Bar>() {
172172
}
173173
```
174174

175-
that is, the information that `T` implements `Bar` here comes from the
175+
That is, the information that `T` implements `Bar` here comes from the
176176
*environment*. The environment is the set of things that we assume to be true
177177
when we type check some Rust declaration. In that case, what we assume is that
178178
`T: Bar`. Then at that point, we might authorize ourselves to have some kind
@@ -182,8 +182,8 @@ only be done within our `foo` function in order to avoid the earlier
182182
problem where we had a global clause.
183183

184184
We can apply these local reasonings everywhere we can have an environment
185-
-- i.e. when we can write where clauses -- that is inside impls,
186-
trait declarations and type declarations.
185+
-- i.e. when we can write where clauses -- that is, inside impls,
186+
trait declarations, and type declarations.
187187

188188
## Computing implied bounds with `FromEnv`
189189

@@ -224,7 +224,7 @@ forall<T> { FromEnv(T: A) :- FromEnv(T: B). }
224224
forall<T> { Implemented(T: C) :- FromEnv(T: C). }
225225
forall<T> { FromEnv(T: C) :- FromEnv(T: C). }
226226
```
227-
So these clauses are defined globally (that is they are available from
227+
So these clauses are defined globally (that is, they are available from
228228
everywhere in the program) but they cannot be used because the hypothesis
229229
is always of the form `FromEnv(...)` which is a bit special. Indeed, as
230230
indicated by the name, `FromEnv(...)` facts can **only** come from the
@@ -266,7 +266,7 @@ impl Bar for Y {
266266
```
267267
We must define what "legal" and "illegal" mean. For this, we introduce another
268268
predicate: `WellFormed(Type: Trait)`. We say that the trait reference
269-
`Type: Trait` is well-formed is `Type` meets the bounds written on the
269+
`Type: Trait` is well-formed if `Type` meets the bounds written on the
270270
`Trait` declaration. For each impl we write, assuming that the where clauses
271271
declared on the impl hold, the compiler tries to prove that the corresponding
272272
trait reference is well-formed. The impl is legal if the compiler manages to do
@@ -433,7 +433,7 @@ impl Foo for i32 {
433433
The `Foo` trait definition and the `impl Foo for i32` are perfectly valid
434434
Rust: we're kind of recursively using our `Foo` impl in order to show that
435435
the associated value indeed implements `Foo`, but that's ok. But if we
436-
translates this to our well-formedness setting, the compiler proof process
436+
translate this to our well-formedness setting, the compiler proof process
437437
inside the `Foo` impl is the following: it starts with proving that the
438438
well-formedness goal `WellFormed(i32: Foo)` is true. In order to do that,
439439
it must prove the following goals: `Implemented(i32: Foo)` and

0 commit comments

Comments
 (0)