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

ices/67830.rs: fixed with errors #1114

Merged
merged 1 commit into from
Feb 9, 2022
Merged

ices/67830.rs: fixed with errors #1114

merged 1 commit into from
Feb 9, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 9, 2022

Issue: rust-lang/rust#67830

trait MyFn<Arg> {
    type Output;
    fn call(&self, arg: Arg) -> Self::Output;
}

struct Wrap<F>(F);

impl<A, B, F> MyFn<A> for Wrap<F>
where
    F: Fn(A) -> B
{
    type Output = B;

    fn call(&self, arg: A) -> Self::Output {
        (self.0)(arg)
    }
}


struct A;
fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
    Wrap(|a| Some(a).into_iter())
}

fn main() {}
=== stdout ===
=== stderr ===
error: implementation of `FnOnce` is not general enough
  --> /home/runner/work/glacier/glacier/ices/67830.rs:22:5
   |
22 |     Wrap(|a| Some(a).into_iter())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
   |
   = note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
   = note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error: implementation of `FnOnce` is not general enough
  --> /home/runner/work/glacier/glacier/ices/67830.rs:22:5
   |
22 |     Wrap(|a| Some(a).into_iter())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
   |
   = note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
   = note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`

error: aborting due to previous error

==============
@Alexendoo Alexendoo merged commit 06c8426 into master Feb 9, 2022
@Alexendoo Alexendoo deleted the autofix/ices/67830.rs branch February 9, 2022 12:54
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