cargo_metadata icon indicating copy to clipboard operation
cargo_metadata copied to clipboard

Made camino an optional dependency.

Open morr0ne opened this issue 2 years ago • 4 comments

As I already said in #193 I don't feel like camino is necessary however there might people that relay/need this kind of behavior so I made it an optional dependency disabled by default. I also updated the changelog with the corresponding entry.

morr0ne avatar Jul 02 '22 07:07 morr0ne

This does not seem right because the cargo feature should be additive.

For example, enabling this feature may break dependencies that do not enable this feature because some signatures of camino and std::path APIs are incompatible. Also, in some cases, third-party traits implemented in std::path are not implemented in camino, so the code that uses them will also be broken.

taiki-e avatar Jul 02 '22 07:07 taiki-e

I assumed Utf8PathBuf implemented all the methods from PathBuf but I see how that can be a problem especially with third-party impls. Is there a better solution to make camino optional? Otherwise it might be better to remove camino entirely. As I said in #193 it adds needless restrictions considering that every Utf8PathBuf is a valid PathBuf but not the other way around.

morr0ne avatar Jul 02 '22 08:07 morr0ne

I assumed Utf8PathBuf implemented all the methods from PathBuf but I see how that can be a problem especially with third-party impls.

That's not the main issue, the main issue is that the types are different, so if someone passes that field to a function expecting a PathBuf, because their crate uses cargo_metadata without the camino feature, then that would break the moment any other crate in the deptree enables the feature.

Will comment on the issue

oli-obk avatar Jul 04 '22 12:07 oli-obk

Yeah I see how that's a big very big issue. Maybe a better solution is a wrapper type kinda like the map in serde_json. But honestly I think camino should be removed all together.

morr0ne avatar Jul 04 '22 12:07 morr0ne