fn dep_paths_for_args(
unit: &Unit,
build_runner: &BuildRunner<'_, '_>,
) -> Vec<PathBuf>Expand description
Generate a list of paths for the rustc -L args.
To generate the list of paths we walk the dependency graph using DFS with a stack.
We try to avoid bloating the amount of args passed rustc as it can cause issues with OS limits for large projects. (and generally just makes the rustc command ugly!). Below are the rules for excluding build units from the args.
- Don’t include build script out dir in the args to reduce rustc command bloat.
- Proc macros are statically linked, so when including a proc-macro dependency we can skip adding it’s dependencies. Note that we still do add them when we are compiling the proc-macro itself.
- Don’t include direct dependencies because they are passed with
--externand rustc does not need-Lif it was already passed as--extern