Skip version mutator for host/ramdisk/recovery

"version" mutator creates stubs variants for "cc" libraries with
"stubs.versions". These stubs are for APEX-APEX or APEX-Platform
boundaries.

For host/ramdisk/recovery variants, stubs are not necessary.

Exempt-From-Owner-Approval: cp from internal

Bug: 153698496
Test: m
Merged-In: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
Change-Id: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
(cherry picked from commit c40b5193fefc962d296d587a546d0427d5a77f70)
diff --git a/rust/rust.go b/rust/rust.go
index 6fe8871..5cc8845 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -735,13 +735,14 @@
 
 	deps := mod.deps(ctx)
 	commonDepVariations := []blueprint.Variation{}
-	commonDepVariations = append(commonDepVariations,
-		blueprint.Variation{Mutator: "version", Variation: ""})
+	if cc.VersionVariantAvailable(mod) {
+		commonDepVariations = append(commonDepVariations,
+			blueprint.Variation{Mutator: "version", Variation: ""})
+	}
 	if !mod.Host() {
 		commonDepVariations = append(commonDepVariations,
 			blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
 	}
-
 	actx.AddVariationDependencies(
 		append(commonDepVariations, []blueprint.Variation{
 			{Mutator: "rust_libraries", Variation: "rlib"},