rust: Cache crateRootPath to avoid ctx
This makes it possible to call crateRootPath in situations where a
ModuleContext is unavailable.
Test: m nothing
Bug: 309943184
Change-Id: Iee20b0606954a18ca516cdac40917d0016f94a05
diff --git a/rust/binary.go b/rust/binary.go
index 146c683..5e7e922 100644
--- a/rust/binary.go
+++ b/rust/binary.go
@@ -137,7 +137,7 @@
fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix()
outputFile := android.PathForModuleOut(ctx, fileName)
ret := buildOutput{outputFile: outputFile}
- crateRootPath := binary.crateRootPath(ctx)
+ crateRootPath := crateRootPath(ctx, binary)
flags.RustFlags = append(flags.RustFlags, deps.depFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.depLinkFlags...)