By anything I mean that X is opaque to this code, its implementation is between whatever calls run and the functions pointed to by the CommandItem::function pointers. All this code needs to do is transport the mut reference between the two. The only reason X is a type parameter is because it has to be part of the signature of the function pointer, its never instantiated except by the caller, and the reference only needs to last through the call to run()
I'm not really getting why it matters that &mut X is invariant in X - this code doesn't actually use X other than to carry the mut reference.
It seems to me to be a similar problem to Argument requires that ... is borrowed for `'static` and to the scoped_threads thing mentioned there, but my understanding isn't great enough yet to be sure.
I suspect I'm still carrying too much C++ baggage in my head! Sorry if I'm being dense.