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

ices/106874.rs: fixed with errors #1658

Merged
merged 1 commit into from
Oct 10, 2023
Merged

ices/106874.rs: fixed with errors #1658

merged 1 commit into from
Oct 10, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 1, 2023

Issue: rust-lang/rust#106874

use std::marker::PhantomData;
use std::rc::Rc;

pub fn func<V, F: Fn(&mut V)>(f: F) -> A<impl X> {
    A(B(C::new(D::new(move |st| f(st)))))
}

trait X {}
trait Y {
    type V;
}

struct A<T>(T);

struct B<T>(Rc<T>);
impl<T> X for B<T> {}

struct C<T: Y>(T::V);
impl<T: Y> C<T> {
    fn new(_: T) -> Rc<Self> {
        todo!()
    }
}
struct D<V, F>(F, PhantomData<fn(&mut V)>);

impl<V, F> D<V, F> {
    fn new(_: F) -> Self {
        todo!()
    }
}
impl<V, F: Fn(&mut V)> Y for D<V, F> {
    type V = V;
}

fn main() {}
=== stdout ===
=== stderr ===
error: higher-ranked lifetime error
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:5
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:7
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected trait `for<'a> Fn<(&'a mut V,)>`
              found trait `Fn<(&mut V,)>`
note: this closure does not fulfill the lifetime requirements
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:23
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |                       ^^^^^^^^^
note: the lifetime requirement is introduced here
  --> /home/runner/work/glacier/glacier/ices/106874.rs:18:13
   |
18 | struct C<T: Y>(T::V);
   |             ^
help: consider specifying the type of the closure parameters
   |
5  |     A(B(C::new(D::new(|st: &_| f(st)))))
   |                       ~~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:7
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`

error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:7
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected trait `for<'a> Fn<(&'a mut V,)>`
              found trait `Fn<(&mut V,)>`
note: this closure does not fulfill the lifetime requirements
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:23
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |                       ^^^^^^^^^
note: the lifetime requirement is introduced here
  --> /home/runner/work/glacier/glacier/ices/106874.rs:15:10
   |
15 | struct B<T>(Rc<T>);
   |          ^
help: consider specifying the type of the closure parameters
   |
5  |     A(B(C::new(D::new(|st: &_| f(st)))))
   |                       ~~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:9
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |         ^^^^^^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`

error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:9
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
  |
  = note: expected trait `for<'a> Fn<(&'a mut V,)>`
             found trait `Fn<(&mut V,)>`
note: this closure does not fulfill the lifetime requirements
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:23
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |                       ^^^^^^^^^
help: consider specifying the type of the closure parameters
  |
5 |     A(B(C::new(D::new(|st: &_| f(st)))))
  |                       ~~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:9
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`

error: higher-ranked subtype error
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:41
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |                                         ^

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0308`.
==============

=== stdout ===
=== stderr ===
error: higher-ranked lifetime error
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:5
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:7
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected trait `for<'a> Fn<(&'a mut V,)>`
              found trait `Fn<(&mut V,)>`
note: this closure does not fulfill the lifetime requirements
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:23
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |                       ^^^^^^^^^
note: the lifetime requirement is introduced here
  --> /home/runner/work/glacier/glacier/ices/106874.rs:18:13
   |
18 | struct C<T: Y>(T::V);
   |             ^
help: consider specifying the type of the closure parameters
   |
5  |     A(B(C::new(D::new(|st: &_| f(st)))))
   |                       ~~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:7
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`

error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:7
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected trait `for<'a> Fn<(&'a mut V,)>`
              found trait `Fn<(&mut V,)>`
note: this closure does not fulfill the lifetime requirements
  --> /home/runner/work/glacier/glacier/ices/106874.rs:5:23
   |
5  |     A(B(C::new(D::new(move |st| f(st)))))
   |                       ^^^^^^^^^
note: the lifetime requirement is introduced here
  --> /home/runner/work/glacier/glacier/ices/106874.rs:15:10
   |
15 | struct B<T>(Rc<T>);
   |          ^
help: consider specifying the type of the closure parameters
   |
5  |     A(B(C::new(D::new(|st: &_| f(st)))))
   |                       ~~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:9
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |         ^^^^^^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`

error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:9
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
  |
  = note: expected trait `for<'a> Fn<(&'a mut V,)>`
             found trait `Fn<(&mut V,)>`
note: this closure does not fulfill the lifetime requirements
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:23
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |                       ^^^^^^^^^
help: consider specifying the type of the closure parameters
  |
5 |     A(B(C::new(D::new(|st: &_| f(st)))))
  |                       ~~~~~~~~

error: implementation of `FnOnce` is not general enough
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:9
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
  |
  = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
  = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`

error: higher-ranked subtype error
 --> /home/runner/work/glacier/glacier/ices/106874.rs:5:41
  |
5 |     A(B(C::new(D::new(move |st| f(st)))))
  |                                         ^

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0308`.
==============
@JohnTitor JohnTitor merged commit 4abf6e3 into master Oct 10, 2023
@JohnTitor JohnTitor deleted the autofix/ices/106874.rs branch October 10, 2023 14:51
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