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
I expected to see this happen: Box<dyn MyIterator<Item = T>> is recognized as a valid instance of MyIterator<Item = T>, given the implementation of MyIterator for Box<T>.
The code compiles without issue on stable and nightly up to nightly-2023-11-03.
On nightly nightly-2023-11-04, it results in the following compiler error:
error[E0277]: the trait bound `(dyn MyIterator<Item = T> + 'static): MyIterator` is not satisfied
--> src/lib.rs:301:20
|
301 | type Iter<T> = Box<dyn MyIterator<Item = T>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyIterator` is not implemented for `(dyn MyIterator<Item = T> + 'static)`
|
= help: the trait `MyIterator` is implemented for `std::boxed::Box<T>`
note: required for `std::boxed::Box<(dyn MyIterator<Item = T> + 'static)>` to implement `MyIterator`
--> src/lib.rs:287:9
|
287 | impl<T> MyIterator for Box<T>
| ^^^^^^^^^^ ^^^^^^
288 | where
289 | T: ?Sized + MyIterator,
| ---------- unsatisfied trait bound introduced here
note: required by a bound in `TraitWithIterator::Iter`
--> src/lib.rs:295:30
|
295 | type Iter<T>: MyIterator<Item = T>;
| ^^^^^^^^ required by this bound in `TraitWithIterator::Iter`
Thanks for opening an issue. I believe this to be similar to #117602 (or a duplicate) which is already fixed on master by #117610. The example doesn't trigger an error on master, and that fix should be available in tomorrow's nightly.
I'll close this issue as already fixed, but feel free to reopen if it happens again after updating to the next nightlies.
I tried this code:
I expected to see this happen:
Box<dyn MyIterator<Item = T>>
is recognized as a valid instance ofMyIterator<Item = T>
, given the implementation ofMyIterator
forBox<T>
.The code compiles without issue on
stable
and nightly up tonightly-2023-11-03
.On nightly
nightly-2023-11-04
, it results in the following compiler error:Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: