Hello.
Apologies for the length, but I don't know how else to explain.
I wrote a crate that exports a procedural macro as well as some helper tools. The exact functionality is-irrelevant, but, assuming the crate name is akete, it is laid out this way:
akete
|_ akete-proc_macro : The proc macro (uses akete-core)
|_ akete-helpers: Some internal and some user-facing utilities
|_ akete-core : Hooks into third-party libs, such as blas (heavily reliant on akete-helpers)
|_ akete: Reexports third party libraries, macros that use akete-proc_macro, and some akete-helpers
My problem
This is all good and the crate works fine, so what's the issue? Well, whilst upgrading to rust 2021 edition, I encountered some problems with the new resolver – Linker errors (that were solvable by explicitly passing features to the proc macro crate).
The akete-core
crate uses blas and some other libs. The user can pick a blas variant with features. The problem, as far as I can gather, was that the features flags needed to execute the proc macro would formerly be unified when the akete-core
crate was resolved anywhere.
My question
Is there a better way to pass features down to all of the crates that need them?
I copy-pasted features to the different sub crates via their Cargo.toml. The user can easily propagate a feature and it will pass on via all the copy-pasted feature, but this is really very confusing and so very easy to break, as I have learnt to my dismay.
By gum, it is a mess for sure! Is there a better way?
Thanks and I appreciate any insights anybody can shed.