Rust executables don't require any dependencies at runtime . There's a few different categories of dependencies that cargo recognizes:
Normal dependencies: these are your standard dependencies that provide some code for you to use
Dev dependencies: dependencies included when running cargo test
Build dependencies: dependencies included when building a build script
Procedural macros: each proc macro crate is compiled as its own executable, then saved, and rustc will use them to expand your code at compile time
Importantly, build dependencies and proc macros are compiled for the host instead of the target.
It's up to you how you want to define "dependency", but in objective terms: since proc macro crates are distributed by source, your example would end up with anyone compiling bar to download and compile the source of crate_apple.
There is a new proposal to allow distributing proc macros as wasm modules, which would let you use them without needing to compile them or their dependencies. There's still a lot of technical work to be done before that would happen, though.
unless you depend on some external libraries like OpenSSL, but this is separate from cargo/rust dependencies ↩︎
If you need a tool that tells you about all your runtime dependencies specifically, you can use cargo-depgraph, which by default generates a graph of only runtime deps.cargo tree can do this, see message below.
Though something being a runtime dependency doesn't actually mean that any symbols from it end up in your binary, for example for macro_rules!-only crates this is always the case, or the crate could only contain generic symbols that are never instantiated for your binary, or the compiler / linker could discard all the symbols from it because they're ultimately found to be unused.
In Rust, when crate bar uses a proc-macro provided by foo_derive, it indirectly relies on the dependencies of foo_derive, such as crate_apple, during the compile process. This means that bar requires these dependencies to be available during compilation, even though it doesn't need them at runtime.
Here's a breakdown:
crate bar depends on foo_derive for the proc macro.
foo_derive depends on crate_apple.
When you compile bar, the proc macro from foo_derive is executed as part of the compilation process. This means that foo_derive, including its dependencies (including crate_apple), must be available at compile time.