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

ices/101020.rs: fixed with errors #1408

Merged
merged 1 commit into from
Aug 31, 2022
Merged

ices/101020.rs: fixed with errors #1408

merged 1 commit into from
Aug 31, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#101020

#![feature(generic_associated_types)]
pub trait LendingIterator {
    type Item<'a>
    where
        Self: 'a;

    fn consume<F>(self, _f: F)
    where
        Self: Sized,
        for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>,
    {
    }
}

impl<I: LendingIterator + ?Sized> LendingIterator for &mut I {
    type Item<'a> = I::Item<'a> where Self: 'a;
}
struct EmptyIter;
impl LendingIterator for EmptyIter {
    type Item<'a> = &'a mut () where Self:'a;
}
pub trait FuncInput<'a, F>
where
    F: Foo<Self>,
    Self: Sized,
{
}
impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {}
trait Foo<T> {}

fn map_test() {
    (&mut EmptyIter).consume(()); 
}
=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `101020`
  --> /home/runner/work/glacier/glacier/ices/101020.rs:33:2
   |
33 | }
   |  ^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/101020.rs`

error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/101020.rs:32:5
   |
32 |     (&mut EmptyIter).consume(()); 
   |     ^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
   |     |
   |     the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`
   |
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
  --> /home/runner/work/glacier/glacier/ices/101020.rs:28:20
   |
28 | impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {}
   |                    ^^^^^^^^^^^^^^^^     ^
note: required by a bound in `LendingIterator::consume`
  --> /home/runner/work/glacier/glacier/ices/101020.rs:10:33
   |
7  |     fn consume<F>(self, _f: F)
   |        ------- required by a bound in this
...
10 |         for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>,
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0601.
For more information about an error, try `rustc --explain E0277`.
==============

=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `101020`
  --> /home/runner/work/glacier/glacier/ices/101020.rs:33:2
   |
33 | }
   |  ^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/101020.rs`

error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/101020.rs:32:5
   |
32 |     (&mut EmptyIter).consume(()); 
   |     ^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
   |     |
   |     the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`
   |
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
  --> /home/runner/work/glacier/glacier/ices/101020.rs:28:20
   |
28 | impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {}
   |                    ^^^^^^^^^^^^^^^^     ^
note: required by a bound in `LendingIterator::consume`
  --> /home/runner/work/glacier/glacier/ices/101020.rs:10:33
   |
7  |     fn consume<F>(self, _f: F)
   |        ------- required by a bound in this
...
10 |         for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>,
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0601.
For more information about an error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit c84cb0f into master Aug 31, 2022
@JohnTitor JohnTitor deleted the autofix/ices/101020.rs branch August 31, 2022 10:35
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