Generic version of `dependencies_diagnostics`.