Fix an infinite loop in error reporting
The `path_to_root` function unfortunately didn't account for cycles in the
dependency graph introduced through dev-dependencies, so if a cycle was present
then the function would infinitely loop pushing items onto a vector.
This commit fixes the infinite loop and also touches up the reporting to be a
little more consistent with the rest of Cargo