Closed
Description
Follow up of #61738.
These two particular cases could not be refactored due to an ambiguity issue:
rust/src/libcore/iter/adapters/flatten.rs
Lines 70 to 76 in 2d1a551
With #![feature(associated_type_bounds)]
impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F>
where
F: FnMut(I::Item) -> U,
U: IntoIterator<IntoIter: DoubleEndedIterator>,
{
#[inline]
fn next_back(&mut self) -> Option<U::Item> { self.inner.next_back() }
Result (line numbers are off):
error[E0221]: ambiguous associated type `Item` in bounds of `U`
--> src/libcore/iter/adapters/flatten.rs:77:39
|
77 | fn next_back(&mut self) -> Option<U::Item> { self.inner.next_back() }
| ^^^^^^^ ambiguous associated type `Item`
|
::: src/libcore/iter/traits/iterator.rs:94:5
|
94 | type Item;
| ---------- ambiguous `Item` from `iter::traits::iterator::Iterator`
|
::: src/libcore/iter/traits/collect.rs:211:5
|
211 | type Item;
| ---------- ambiguous `Item` from `iter::traits::collect::IntoIterator`
rust/src/libcore/iter/adapters/flatten.rs
Lines 107 to 110 in 2d1a551
With #![feature(associated_type_bounds)]
pub struct Flatten<I: Iterator<Item: IntoIterator>> {
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
}
Result (line numbers are off):
error[E0221]: ambiguous associated type `Item` in bounds of `I`
--> src/libcore/iter/adapters/flatten.rs:112:30
|
112 | inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
| ^^^^^^^ ambiguous associated type `Item`
|
::: src/libcore/iter/traits/collect.rs:211:5
|
211 | type Item;
| ---------- ambiguous `Item` from `iter::traits::collect::IntoIterator`
|
::: src/libcore/iter/traits/iterator.rs:94:5
|
94 | type Item;
| ---------- ambiguous `Item` from `iter::traits::iterator::Iterator`
Metadata
Metadata
Labels
Area: Associated items (types, constants & functions)Category: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example`#![feature(associated_type_bounds)]`Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.