-
Notifications
You must be signed in to change notification settings - Fork 364
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.
cbindgendepends onsynwhich depends onproc-macro-2becausesynis geared to be used in proc-macros not random binaries for parsing rust code.proc-macro-2is the problematic library that causes this crash because it depends on internal compiler libs.
cbindgendoesn't need any of the functionality fromsynthat usesproc-macro-2though, so we had a feature added tosyncalledproc-macrothat we could use to disable this dependency. But disabling that feature is not enough to preventproc-macro-2from being linked.Unfortunately
proc-macro-2is used byserde_deriveas 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_deriveneeds that flag enabled. Even thoughserde_deriveonly 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_deriverequirement either. It's used for parsingcbindgen.tomlwhich isn't required if all you care about isbuild.rs. But it is used for parsingCargo.lockwhich is required for most uses of the crate.This has been a major pain, and I'd love to find an answer to it.