Closed eliaslevy closed 4 years ago
Sorry, I missed this one. We should probably look into it. This is cbindgen failing to parse the Cargo.toml
of a dependency as valid toml. Which is a bit weird.
Hello,
I was going to fill another issue but it's probably the same problem, I got the same error with cgmath
.
I did a bit of investigation and it seems that it comes from winapi
that specifies target-specific dependencies this way:
[target.i686-pc-windows-gnu.dependencies.winapi-i686-pc-windows-gnu]
version = "0.4"
[target.x86_64-pc-windows-gnu.dependencies.winapi-x86_64-pc-windows-gnu]
version = "0.4"
According to cargo documentation this is valid:
In addition to #[cfg] syntax, Cargo also supports listing out the full target the dependencies would apply to:
[target.x86_64-pc-windows-gnu.dependencies] winhttp = "0.4.0" [target.i686-unknown-linux-gnu.dependencies] openssl = "1.0.1"
But the way this is parsed is using this:
syn::parse_str::<syn::Meta>(target)
which does not accept such a token, if my understanding is correct.
The best way to fix this issue is probably to modify load_metadata
so it can handle the token properly - my knowledge of syn
and cbindgen
is not good enough yet to propose a fix directly but I could write hacky code to work around the issue and it seems to be fine.