// issue: rust-lang/rust#106874 // ICE BoundUniversalRegionError use std::marker::PhantomData; use std::rc::Rc; pub fn func(f: F) -> A { A(B(C::new(D::new(move |st| f(st))))) //~^ ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `Fn` is not general enough //~| ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `Fn` is not general enough //~| ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `Fn` is not general enough //~| ERROR implementation of `FnOnce` is not general enough //~| ERROR higher-ranked subtype error //~| ERROR higher-ranked subtype error } trait X {} trait Y { type V; } struct A(T); struct B(Rc); impl X for B {} struct C(T::V); impl C { fn new(_: T) -> Rc { todo!() } } struct D(F, PhantomData); impl D { fn new(_: F) -> Self { todo!() } } impl Y for D { type V = V; } pub fn main() {}