Skip to content

Commit 5d1080a

Browse files
Allow implementable aliases in paths more generally
1 parent cd871e0 commit 5d1080a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

text/3437-implementable-trait-alias.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,16 @@ impl Frobber for MyType {
287287

288288
Trait aliases are `unsafe` to implement iff the underlying trait is marked `unsafe`.
289289

290-
Implementable trait aliases can also be used with trait-qualified and fully-qualified method call syntax. When used this way,
291-
they are treated equivalently to the underlying primary trait, with the additional restriction that all `where` clauses and associated type bounds
290+
Implementable trait aliases can also be used with trait-qualified and fully-qualified method call syntax, as well as in paths more generally. When used this way, they are treated equivalently to the underlying primary trait, with the additional restriction that all `where` clauses and associated type bounds
292291
must be satisfied.
293292

294293
```rust
295294
trait IntIter = Iterator<Item = u32> where Self: Clone;
296295

297296
fn foo() {
298297
let iter = [1_u32].into_iter();
299-
IntIter::next(&mut iter); // works
300-
<std::array::IntoIter as IntIter>::next(); // works
298+
let _: IntIter::Item = IntIter::next(&mut iter); // works
299+
let _: <std::array::IntoIter as IntIter>::Item = <std::array::IntoIter as IntIter>::next(); // works
301300
//IntIter::clone(&iter); // ERROR: trait `Iterator` has no method named `clone()`
302301
let dyn_iter: &mut dyn Iterator<Item = u32> = &mut iter;
303302
//IntIter::next(dyn_iter); // ERROR: `dyn Iterator<Item = u32>` does not implement `Clone`

0 commit comments

Comments
 (0)