@@ -97,7 +97,7 @@ Here are some problems that unboxed abstract types solve or mitigate:
97
97
98
98
* _Returning unboxed closures_ . Closure syntax generates an anonymous type
99
99
implementing a closure trait . Without unboxed abstract types , there is no way
100
- to use this syntax while returning the resulting closure unboxed , because there
100
+ to use this syntax while returning the resulting closure unboxed because there
101
101
is no way to write the name of the generated type .
102
102
103
103
* _Leaky APIs_ . Functions can easily leak implementation details in their return
@@ -141,7 +141,7 @@ with other extensions.
141
141
## Syntax
142
142
143
143
Let 's start with the bikeshed : The proposed syntax is `impl Trait ` in return type
144
- position , composing like trait objects to forms like `impl Foo + Send + 'a `.
144
+ position , composing like trait objects to forms like `impl Foo + Send + 'a `.
145
145
146
146
It can be explained as " a type that implements `Trait`" ,
147
147
and has been used in that form in most earlier discussions and proposals .
@@ -162,7 +162,7 @@ The core semantics of the feature is described below.
162
162
163
163
Note that the sections after this one go into more detail on some of the design
164
164
decisions , and that * * it is likely for many of the mentioned limitations to be
165
- lifted at some point in the future ** . For clarity , we 'll separately categories the * core
165
+ lifted at some point in the future ** . For clarity , we 'll separately categorize the * core
166
166
semantics * of the feature (aspects that would stay unchanged with future extensions )
167
167
and the * initial limitations * (which are likely to be lifted later ).
168
168
@@ -181,7 +181,7 @@ and the *initial limitations* (which are likely to be lifted later).
181
181
- The type would not be known to implement any other trait , with
182
182
the exception of OIBITS (aka " auto traits" ) and default traits like `Sized `.
183
183
- The type would not be considered equal to the actual underlying type .
184
- - The type would not be allowed to appear as the Self type for an `impl ` block .
184
+ - The type would not be allowed to appear as the ` Self ` type for an `impl ` block .
185
185
186
186
- Because OIBITS like `Send ` and `Sync ` will leak through an abstract return
187
187
type , there will be some additional complexity in the compiler due to some
@@ -223,7 +223,7 @@ and the *initial limitations* (which are likely to be lifted later).
223
223
unless these are themselves part of a legal return type.
224
224
225
225
- Eventually, we will want to allow the feature to be used within traits, and
226
- like in argument position as well (as an ergonomic improvement over today's generics).
226
+ likely in argument position as well (as an ergonomic improvement over today's generics).
227
227
- Using ` impl Trait ` multiple times in the same return type would be valid,
228
228
like for example in ` -> (impl Foo, impl Bar) ` .
229
229
@@ -252,7 +252,7 @@ and the *initial limitations* (which are likely to be lifted later).
252
252
253
253
## Rationale
254
254
255
- ### Why this semantics for the return type?
255
+ ### Why these semantics for the return type?
256
256
257
257
There has been a lot of discussion about what the semantics of the return type
258
258
should be, with the theoretical extremes being "full return type inference" and
@@ -410,11 +410,11 @@ so the syntax is forbidden there.
410
410
411
411
### Compatibility with conditional trait bounds
412
412
413
- On valid critique for the existing ` impl Trait ` proposal is that it does not
414
- cover more complex scenarios, where the return type would implement
413
+ One valid critique for the existing ` impl Trait ` proposal is that it does not
414
+ cover more complex scenarios where the return type would implement
415
415
one or more traits depending on whether a type parameter does so with another.
416
416
417
- For example, a iterator adapter might want to implement ` Iterator ` and
417
+ For example, an iterator adapter might want to implement ` Iterator ` and
418
418
` DoubleEndedIterator ` , depending on whether the adapted one does:
419
419
420
420
``` rust
@@ -426,7 +426,7 @@ impl<I: DoubleEndedIterator> DoubleEndedIterator for SkipOne<I> { ... }
426
426
427
427
Using just ` -> impl Iterator ` , this would not be possible to reproduce.
428
428
429
- Since there has been no proposals so far that would address this in a way
429
+ Since there have been no proposals so far that would address this in a way
430
430
that would conflict with the fixed-trait-set case, this RFC punts on that issue as well.
431
431
432
432
### Limitation to free/inherent functions
@@ -435,10 +435,10 @@ One important usecase of abstract return types is to use them in trait methods.
435
435
436
436
However, there is an issue with this, namely that in combinations with generic
437
437
trait methods, they are effectively equivalent to higher kinded types.
438
- Which is an issue because Rust HKT story is not yet figured out, so
438
+ Which is an issue because Rust's HKT story is not yet figured out, so
439
439
any "accidental implementation" might cause unintended fallout.
440
440
441
- HKT allows you to be generic over a type constructor, aka a
441
+ HKT allows you to be generic over a type constructor, a.k.a. a
442
442
"thing with type parameters", and then instantiate them at some later point to
443
443
get the actual type.
444
444
For example, given a HK type ` T ` that takes one type as parameter, you could
@@ -459,7 +459,7 @@ with a `u32` or `bool`,
459
459
just like `T <u32 >` and `T <bool >` might give us `Vec <u32 >` or `Box <bool >`
460
460
in the example above .
461
461
462
- The problem does not exists with trait method return types today because
462
+ The problem does not exist with trait method return types today because
463
463
they are concrete :
464
464
465
465
```rust
@@ -472,7 +472,7 @@ Given the above code, there is no way for `bar` to choose a return type `X`
472
472
that could fundamentally differ between instantiations of `Self `
473
473
while still being instantiable with an arbitrary `U `.
474
474
475
- At most you could return a associated type , but then you 'd loose the generics
475
+ At most you could return a associated type , but then you 'd lose the generics
476
476
from `bar `
477
477
478
478
```rust
@@ -482,7 +482,7 @@ trait Foo {
482
482
}
483
483
```
484
484
485
- So , in conclusion , since Rusts HKT story is not yet fleshed out ,
485
+ So , in conclusion , since Rust ' s HKT story is not yet fleshed out ,
486
486
and the compatibility of the current compiler with it is unknown ,
487
487
it is not yet possible to reach a concrete solution here .
488
488
0 commit comments