Skip to content

Commit 4ad2de6

Browse files
authored
Merge pull request #1680 from shepmaster/impl-trait-typos
Correct typos in impl trait
2 parents 7de9b49 + a229528 commit 4ad2de6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

text/1522-conservative-impl-trait.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Summary
77
[summary]: #summary
88

9-
Add a conservative form of abstract return types, aka `impl Trait`,
10-
that will be compatible with most possible future extensions by
11-
initially being restricted to:
9+
Add a conservative form of abstract return types, also known as `impl
10+
Trait`, that will be compatible with most possible future extensions
11+
by initially being restricted to:
1212

1313
- Only free-standing or inherent functions.
1414
- Only return type position of a function.
@@ -175,7 +175,7 @@ and the *initial limitations* (which are likely to be lifted later).
175175
- As far as the typesystem and the compiler is concerned, the return type
176176
outside of the function would not be a entirely "new" type, nor would it be a
177177
simple type alias. Rather, its semantics would be very similar to that of
178-
_generic type paramters_ inside a function, with small differences caused by
178+
_generic type parameters_ inside a function, with small differences caused by
179179
being an _output_ rather than an _input_ of the function.
180180

181181
- The type would be known to implement the specified traits.
@@ -189,7 +189,7 @@ and the *initial limitations* (which are likely to be lifted later).
189189
non-local type checking becoming necessary.
190190

191191
- The return type has an identity based on all generic parameters the
192-
function body is parametrized by, and by the location of the function
192+
function body is parameterized by, and by the location of the function
193193
in the module system. This means type equality behaves like this:
194194

195195
```rust
@@ -211,7 +211,7 @@ and the *initial limitations* (which are likely to be lifted later).
211211

212212
- The code generation passes of the compiler would not draw a distinction
213213
between the abstract return type and the underlying type, just like they don't
214-
for generic paramters. This means:
214+
for generic parameters. This means:
215215
- The same trait code would be instantiated, for example, `-> impl Any`
216216
would return the type id of the underlying type.
217217
- Specialization would specialize based on the underlying type.
@@ -221,7 +221,7 @@ and the *initial limitations* (which are likely to be lifted later).
221221
- `impl Trait` may only be written within the return type of a freestanding or
222222
inherent-impl function, not in trait definitions or any non-return type position. They may also not appear
223223
in the return type of closure traits or function pointers,
224-
unless these are themself part of a legal return type.
224+
unless these are themselves part of a legal return type.
225225

226226
- Eventually, we will want to allow the feature to be used within traits, and
227227
like in argument position as well (as an ergonomic improvement over today's generics).
@@ -262,7 +262,7 @@ was in fact the main focus of the
262262
[blog post](http://aturon.github.io/blog/2015/09/28/impl-trait/) on `impl
263263
Trait`.)
264264

265-
The design as choosen in this RFC lies somewhat in between those two, since it
265+
The design as chosen in this RFC lies somewhat in between those two, since it
266266
allows OIBITs to leak through, and allows specialization to "see" the full type
267267
being returned. That is, `impl Trait` does not attempt to be a "tightly sealed"
268268
abstraction boundary. The rationale for this design is a mixture of pragmatics
@@ -308,15 +308,15 @@ item-level API, but has been deemed worth it for the following reasons:
308308

309309
- Ergonomics: Trait objects already have the issue of explicitly needing to
310310
declare `Send`/`Sync`-ability, and not extending this problem to abstract
311-
return types is desireable. In practice, most uses of this feature would have
311+
return types is desirable. In practice, most uses of this feature would have
312312
to add explicit bounds for OIBITS if they wanted to be maximally usable.
313313

314314
- Low real change, since the situation already somewhat exists on structs with private fields:
315315
- In both cases, a change to the private implementation might change whether a OIBIT is
316316
implemented or not.
317-
- In both cases, the existence of OIBIT impls is not visible without doc tools
317+
- In both cases, the existence of OIBIT impls is not visible without documentation tools
318318
- In both cases, you can only assert the existence of OIBIT impls
319-
by adding explicit trait bounds either to the API or to the crate's testsuite.
319+
by adding explicit trait bounds either to the API or to the crate's test suite.
320320

321321
In fact, a large part of the point of OIBITs in the first place was to cut
322322
across abstraction barriers and provide information about a type without the
@@ -327,7 +327,7 @@ change a function with a abstract return type in a way that removes OIBIT impls,
327327
which might be a problem. (As noted above, this is already the case for `struct`
328328
definitions.)
329329

330-
But since the number of used OIBITs is relatvly small, deducing the return type
330+
But since the number of used OIBITs is relatively small, deducing the return type
331331
in a function body and reasoning about whether such a breakage will occur has
332332
been deemed as a manageable amount of work.
333333

@@ -409,7 +409,7 @@ Because `impl Trait` defines a type tied to the concrete function body,
409409
it does not make much sense to talk about it separately in a function signature,
410410
so the syntax is forbidden there.
411411

412-
### Compability with conditional trait bounds
412+
### Compatibility with conditional trait bounds
413413

414414
On valid critique for the existing `impl Trait` proposal is that it does not
415415
cover more complex scenarios, where the return type would implement
@@ -437,7 +437,7 @@ One important usecase of abstract return types is to use them in trait methods.
437437
However, there is an issue with this, namely that in combinations with generic
438438
trait methods, they are effectively equivalent to higher kinded types.
439439
Which is an issue because Rust HKT story is not yet figured out, so
440-
any "accidential implementation" might cause unintended fallout.
440+
any "accidental implementation" might cause unintended fallout.
441441

442442
HKT allows you to be generic over a type constructor, aka a
443443
"thing with type parameters", and then instantiate them at some later point to
@@ -531,13 +531,13 @@ See the links in the motivation section for detailed analysis that we won't
531531
repeat here.
532532

533533
But basically, without this feature certain things remain hard or impossible to do
534-
in Rust, like returning a efficiently usable type parametricised by
534+
in Rust, like returning a efficiently usable type parameterized by
535535
types private to a function body, for example an iterator adapter containing a closure.
536536

537537
# Unresolved questions
538538
[unresolved]: #unresolved-questions
539539

540-
> What parts of the design are still TBD?
540+
> What parts of the design are still to be determined?
541541

542542
The precise implementation details for OIBIT transparency are a bit unclear: in
543543
general, it means that type checking may need to proceed in a particular order,

0 commit comments

Comments
 (0)