Classify Rust static libraries as final
Rust static libraries are used from C/C++ code and therefore require all
dependencies to be linked in as we cannot link their (Rust) dependencies
directly as we would with the non-complete_static_lib case.
Change-Id: I4fe7e52a863ff09472f44848cd5b76beb111d29a
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/6820
Commit-Queue: Petr Hosek <phosek@google.com>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/src/gn/target.cc b/src/gn/target.cc
index 5c2e721..0d76159 100644
--- a/src/gn/target.cc
+++ b/src/gn/target.cc
@@ -416,7 +416,12 @@
output_type_ == LOADABLE_MODULE || output_type_ == ACTION ||
output_type_ == ACTION_FOREACH || output_type_ == COPY_FILES ||
output_type_ == CREATE_BUNDLE || output_type_ == RUST_PROC_MACRO ||
- (output_type_ == STATIC_LIBRARY && complete_static_lib_);
+ (output_type_ == STATIC_LIBRARY &&
+ (complete_static_lib_ ||
+ // Rust static libraries may be used from C/C++ code and therefore
+ // require all dependencies to be linked in as we cannot link their
+ // (Rust) dependencies directly as we would for C/C++.
+ source_types_used_.RustSourceUsed()));
}
DepsIteratorRange Target::GetDeps(DepsIterationType type) const {