Discussing what the erorr means:
struct A<T, E> {
pointer: for<'a> fn(arg: &'a str, extra: T) -> E,
}
T can't contain 'a because 'a doesn't exist where T is introduced (on struct A<T, E>). That 'a isn't introduced until the for<'a> ....
Let's get away from lifetimes for a minute:
trait Example<T> {
fn to_vec<NotALifetime>(&self, arg: NotALifetime) -> Vec<T>;
}
impl Example<What> for () {
fn to_vec<NotALifetime>(&self, arg: NotALifetime) -> Vec<What> {
vec![arg]
}
}
What do you put in place of What? You can't put something like String there -- you're trying to return a Vec<NotALifetime>. You can't use impl<T> Example<T> either, because calls to say <() as Example<String>>::to_vec::<u32> return a Vec<String> and not a Vec<u32>.
There's no way for T to depend on the NotALifetime parameter that was introduced later. Within a given implementation block, the T parameter must resolve to a single type, not something that can be different based on NotALifetime. Rephrased: T can't contain NotALifetime because NotALifetime doesn't exist where T is introduced.
And it works the same way in the OP, as I mentioned above: T can't contain 'a because 'a doesn't exist where T is introduced.
struct A<'a, T, E> {
pointer: fn(arg: &'a str, extra: T) -> E,
}
fn exmple<'b, 'c, E>() -> A<'b, E, ()>
where
'b: 'c,
E: ExactSizeIterator<Item = &'c mut Option<&'b [u8]>>,
Now 'a and T (or in the exmple, 'b and E) are introduced at the same time, so the type can contain the lifetime.
(There's a good chance you're overusing lifetimes/lifetime-carrying structs.)