Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/108580.rs: fixed with errors #1618

Merged
merged 1 commit into from
Jul 8, 2023
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jul 2, 2023

Issue: rust-lang/rust#108580

#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

trait Iterator {
    type Item;
}

trait IntoIterator {
    fn into_iterator(&self) -> impl Iterator<Item: > + '_;
}

struct IntoIterFn<F, I> {
    f: F,
    _marker: core::marker::PhantomData<I>,
}

impl<F, I> IntoIterator for IntoIterFn<F, I>
where
    F: Fn() -> I,
    I: Iterator,
{
    fn into_iterator(&self) -> impl Iterator<Item: '_> {
        (self.f)()
    }
}

fn main() {}
=== stdout ===
=== stderr ===
error: return type captures more lifetimes than trait definition
  --> /home/runner/work/glacier/glacier/ices/108580.rs:22:46
   |
22 |     fn into_iterator(&self) -> impl Iterator<Item: '_> {
   |                      -                       ^^^^^^^^
   |                      |
   |                      this lifetime was captured
   |
note: hidden type must only reference lifetimes captured by this impl trait
  --> /home/runner/work/glacier/glacier/ices/108580.rs:9:46
   |
9  |     fn into_iterator(&self) -> impl Iterator<Item: > + '_;
   |                                              ^^^^^
   = note: hidden type inferred to be `impl Sized + '_`

error: aborting due to previous error

==============

=== stdout ===
=== stderr ===
error: return type captures more lifetimes than trait definition
  --> /home/runner/work/glacier/glacier/ices/108580.rs:22:46
   |
22 |     fn into_iterator(&self) -> impl Iterator<Item: '_> {
   |                      -                       ^^^^^^^^
   |                      |
   |                      this lifetime was captured
   |
note: hidden type must only reference lifetimes captured by this impl trait
  --> /home/runner/work/glacier/glacier/ices/108580.rs:9:46
   |
9  |     fn into_iterator(&self) -> impl Iterator<Item: > + '_;
   |                                              ^^^^^
   = note: hidden type inferred to be `impl Sized + '_`

error: aborting due to previous error

==============
@JohnTitor JohnTitor merged commit 87abfd7 into master Jul 8, 2023
@JohnTitor JohnTitor deleted the autofix/ices/108580.rs branch July 8, 2023 02:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants