summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2020-09-28 13:22:45 -0400
committerIvan Lozano <ivanlozano@google.com>2020-09-28 13:26:05 -0400
commitdd0554722ac788bb5cdfbfe2fc5b8568eeb5372e (patch)
tree0b4750fde9c7bb7d7c30012fc026ce1cd770efe2 /rust/compiler.go
parent11200870b0cd84e9bbccb89b66cf59b5ed4db526 (diff)
rust: Refactor staticStd to stdLinkage
Instead of returning a boolean, return an enum value to improve readability and provide greater flexibility for future modifications. Bug: 168729404 Test: Soong tests pass Change-Id: Iddcdae8c34be09e476404382e43d1ea5935bae65
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index aeb904b37..102f9dc8d 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -24,6 +24,14 @@ import (
"android/soong/rust/config"
)
+type RustLinkage int
+
+const (
+ DefaultLinkage RustLinkage = iota
+ RlibLinkage
+ DylibLinkage
+)
+
func (compiler *baseCompiler) edition() string {
return proptools.StringDefault(compiler.Properties.Edition, config.DefaultEdition)
}
@@ -146,12 +154,12 @@ func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath {
panic("baseCompiler does not implement coverageOutputZipPath()")
}
-func (compiler *baseCompiler) staticStd(ctx *depsContext) bool {
+func (compiler *baseCompiler) stdLinkage(ctx *depsContext) RustLinkage {
// For devices, we always link stdlibs in as dylibs by default.
if ctx.Device() {
- return false
+ return DylibLinkage
} else {
- return true
+ return RlibLinkage
}
}