rust: Alias rust_ffi_rlib to rust_library_rlib

With the new transition mutators, the distinctions between rust_ffi_rlib
and rust_library_rlib are not necessary. This CL removes the remaining
distinctions to allow an unusual use case where a rust_library and a
rust_ffi_rlib would otherwise be created from the same source. This
would allow defining a single rust_library_rlib that works for both rust
modules and cc modules.

One key change is that rust_ffi_rlibs only produced an rlib-std variant
previously, and now produce dylib-std variants as well.This surfaced an
issue where a libstd linkage mismatch would cause rustc to throw a
consufing missing crate error. We instead add logic to catch this in
Soong and provide a more useful error message.

Bug: 383552450
Test: m rust
Test: m blueprint_tests
Change-Id: I611ca46934059735d06229952cfd8e0ab7050486
diff --git a/cc/cc.go b/cc/cc.go
index 04b66d4..812d1c3 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1197,11 +1197,6 @@
 	return false
 }
 
-func (c *Module) IsRustFFI() bool {
-	// cc modules are not Rust modules
-	return false
-}
-
 func (c *Module) Module() android.Module {
 	return c
 }
diff --git a/cc/library.go b/cc/library.go
index ebc65ef..ad8128e 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -2112,7 +2112,7 @@
 		} else {
 			// Header only
 		}
-	} else if library, ok := ctx.Module().(LinkableInterface); ok && (library.CcLibraryInterface() || library.RustLibraryInterface()) {
+	} else if library, ok := ctx.Module().(LinkableInterface); ok && (library.CcLibraryInterface()) {
 		// Non-cc.Modules may need an empty variant for their mutators.
 		variations := []string{}
 		if library.NonCcVariants() {
@@ -2167,7 +2167,7 @@
 		}
 		buildStatic := library.BuildStaticVariant() && !isLLNDK
 		buildShared := library.BuildSharedVariant()
-		if library.BuildRlibVariant() && library.IsRustFFI() && !buildStatic && (incomingVariation == "static" || incomingVariation == "") {
+		if library.BuildRlibVariant() && !buildStatic && (incomingVariation == "static" || incomingVariation == "") {
 			// Rust modules do not build static libs, but rlibs are used as if they
 			// were via `static_libs`. Thus we need to alias the BuildRlibVariant
 			// to "static" for Rust FFI libraries.
diff --git a/cc/linkable.go b/cc/linkable.go
index 1fade71..d0f03c5 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -102,9 +102,6 @@
 	IsPrebuilt() bool
 	Toc() android.OptionalPath
 
-	// IsRustFFI returns true if this is a Rust FFI library.
-	IsRustFFI() bool
-
 	// IsFuzzModule returns true if this a *_fuzz module.
 	IsFuzzModule() bool