rust: Add common interface for binaries
Structs embedding binaryDecorator (rust_test, rust_benchmark, rust_fuzz)
are binaries as well, but won't pass checks against *binaryDecorator,
such as the check in StaticExecutable().
Add a binaryInterface that can be checked instead to simplify these
checks and ensure we catch all binaries.
Bug: 170672854
Test: rust_test, rust_benchmark return true StaticallyLinked
Change-Id: I2373d3663373a6977260785602a02d39a41320fe
diff --git a/rust/sanitize.go b/rust/sanitize.go
index a4ba4bd..baa383d 100644
--- a/rust/sanitize.go
+++ b/rust/sanitize.go
@@ -311,8 +311,8 @@
func (mod *Module) StaticallyLinked() bool {
if lib, ok := mod.compiler.(libraryInterface); ok {
return lib.rlib() || lib.static()
- } else if binary, ok := mod.compiler.(*binaryDecorator); ok {
- return Bool(binary.Properties.Static_executable)
+ } else if binary, ok := mod.compiler.(binaryInterface); ok {
+ return binary.staticallyLinked()
}
return false
}