You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since RFC 2071 was accepted, the initial implementation of `existential type`[has already been completed](https://github.com/rust-lang/rust/pull/52024). This RFC would simply replace the syntax of `existential type`, from:
287
+
Since RFC 2071 was accepted, the initial implementation of `existential type`[has already been completed](https://github.com/rust-lang/rust/pull/52024). This RFC would replace the syntax of `existential type`, from:
288
288
289
289
```rust
290
290
existentialtypeFoo:Bar;
@@ -296,7 +296,21 @@ to:
296
296
typeFoo=implBar;
297
297
```
298
298
299
-
In addition, when documenting `impl Trait`, explanations of the feature would avoid type theoretic terminology (specifically "existential types") and prefer type inference language (if any technical description is needed at all).
299
+
In addition, having multiple occurrences of `impl Trait` in a type alias or associated type is now permitted, where each occurrence is desugared into a separate inferred type. For example, the following alias:
300
+
301
+
```rust
302
+
typeFoo=Arc<implIterator<Item=implDebug>>;
303
+
```
304
+
305
+
would be desugared to the equivalent of:
306
+
307
+
```rust
308
+
existentialtype_0:Debug;
309
+
existentialtype_1:Iterator<Item=_0>;
310
+
typeFoo=Arc<_1>;
311
+
```
312
+
313
+
Furthermore, when documenting `impl Trait`, explanations of the feature would avoid type theoretic terminology (specifically "existential types") and prefer type inference language (if any technical description is needed at all).
300
314
301
315
`impl Trait` type aliases may contain generic parameters just like any other type alias. The type alias must contain the same type parameters as its concrete type, except those implicitly captured in the scope (see [RFC 2071](https://github.com/rust-lang/rfcs/blob/master/text/2071-impl-trait-existential-types.md) for details).
302
316
@@ -397,19 +411,4 @@ The other alternatives commonly given are:
397
411
# Unresolved questions
398
412
[unresolved-questions]: #unresolved-questions
399
413
400
-
- The restriction of type alias `impl Trait` to the forms that are currently possible with `existential trait` is potentially unnecessary. Although this was proposed to simplify the RFC by only changing syntax, it could be a better choice to allow `impl Trait` anywhere in a type alias (by desugaring each occurrence into a separate inferred type).
401
-
402
-
In this case, each occurrence of `impl Trait` would be desugared to a new existential type. For example,
0 commit comments