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/proc_macro.go b/rust/proc_macro.go
index e3a48bf..8a0543d 100644
--- a/rust/proc_macro.go
+++ b/rust/proc_macro.go
@@ -79,7 +79,7 @@
fileName := procMacro.getStem(ctx) + ctx.toolchain().ProcMacroSuffix()
outputFile := android.PathForModuleOut(ctx, fileName)
- srcPath := procMacro.crateRootPath(ctx)
+ srcPath := crateRootPath(ctx, procMacro)
ret := TransformSrctoProcMacro(ctx, srcPath, deps, flags, outputFile)
procMacro.baseCompiler.unstrippedOutputFile = outputFile
return ret