-
Notifications
You must be signed in to change notification settings - Fork 349
Description
From #159
I thought we had an issue filed with exactly what is going on here, but we don't exactly. I'll summarize it here for reference and file an issue later.
cbindgen
depends onsyn
which depends onproc-macro-2
becausesyn
is geared to be used in proc-macros not random binaries for parsing rust code.proc-macro-2
is the problematic library that causes this crash because it depends on internal compiler libs.
cbindgen
doesn't need any of the functionality fromsyn
that usesproc-macro-2
though, so we had a feature added tosyn
calledproc-macro
that we could use to disable this dependency. But disabling that feature is not enough to preventproc-macro-2
from being linked.Unfortunately
proc-macro-2
is used byserde_derive
as a build time proc-macro crate, and cargo does feature flag resolution once for build dependencies and binary dependencies. So our feature flag gets overridden becauseserde_derive
needs that flag enabled. Even thoughserde_derive
only happens at compile time, and we want the feature disabled at run time.But not all
serde_derive
's have this dependency. Which is why we pin to a version which doesn't yet have it.That's what rust-lang/cargo#2589 is about, and why it's still relevant. If that's fixed we could use the feature flag and update
serde_derive
.I don't think we could easily drop the
serde_derive
requirement either. It's used for parsingcbindgen.toml
which isn't required if all you care about isbuild.rs
. But it is used for parsingCargo.lock
which is required for most uses of the crate.This has been a major pain, and I'd love to find an answer to it.