Deprecate Snapshot build

Existing snapshot code will no longer work from VNDK deprecation, but it
can give confusion to users if we keep code for the snapshot - and it
adds complexity on existing code while it is not in use. This change
removes all snapshot definition except host snapshot and its usage.

Bug: 330100430
Bug: 332986564
Test: AOSP CF build succeeded
Change-Id: Ieb6fa43d5e38315c662ce997bc305b744b367c24
diff --git a/rust/Android.bp b/rust/Android.bp
index c5e94a0..53c9462 100644
--- a/rust/Android.bp
+++ b/rust/Android.bp
@@ -12,7 +12,6 @@
         "soong-bloaty",
         "soong-cc",
         "soong-rust-config",
-        "soong-snapshot",
         "soong-testing",
     ],
     srcs: [
@@ -36,8 +35,6 @@
         "rust.go",
         "sanitize.go",
         "source_provider.go",
-        "snapshot_prebuilt.go",
-        "snapshot_utils.go",
         "strip.go",
         "test.go",
         "testing.go",
diff --git a/rust/androidmk.go b/rust/androidmk.go
index e0cb3ce..4ae907c 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -154,11 +154,6 @@
 		})
 }
 
-func (library *snapshotLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) {
-	ctx.SubAndroidMk(ret, library.libraryDecorator)
-	ret.SubName = library.SnapshotAndroidMkSuffix()
-}
-
 func (procMacro *procMacroDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) {
 	ctx.SubAndroidMk(ret, procMacro.baseCompiler)
 
diff --git a/rust/library.go b/rust/library.go
index 3560d73..6be4917 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -104,8 +104,6 @@
 	includeDirs       android.Paths
 	sourceProvider    SourceProvider
 
-	collectedSnapshotHeaders android.Paths
-
 	// table-of-contents file for cdylib crates to optimize out relinking when possible
 	tocFile android.OptionalPath
 }
@@ -749,55 +747,3 @@
 		}
 	}
 }
-
-func (l *libraryDecorator) snapshotHeaders() android.Paths {
-	if l.collectedSnapshotHeaders == nil {
-		panic("snapshotHeaders() must be called after collectHeadersForSnapshot()")
-	}
-	return l.collectedSnapshotHeaders
-}
-
-// collectHeadersForSnapshot collects all exported headers from library.
-// It globs header files in the source tree for exported include directories,
-// and tracks generated header files separately.
-//
-// This is to be called from GenerateAndroidBuildActions, and then collected
-// header files can be retrieved by snapshotHeaders().
-func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext, deps PathDeps) {
-	ret := android.Paths{}
-
-	// Glob together the headers from the modules include_dirs property
-	for _, path := range android.CopyOfPaths(l.includeDirs) {
-		dir := path.String()
-		globDir := dir + "/**/*"
-		glob, err := ctx.GlobWithDeps(globDir, nil)
-		if err != nil {
-			ctx.ModuleErrorf("glob of %q failed: %s", globDir, err)
-			return
-		}
-
-		for _, header := range glob {
-			// Filter out only the files with extensions that are headers.
-			found := false
-			for _, ext := range cc.HeaderExts {
-				if strings.HasSuffix(header, ext) {
-					found = true
-					break
-				}
-			}
-			if !found {
-				continue
-			}
-			ret = append(ret, android.PathForSource(ctx, header))
-		}
-	}
-
-	// Glob together the headers from C dependencies as well, starting with non-generated headers.
-	ret = append(ret, cc.GlobHeadersForSnapshot(ctx, append(android.CopyOfPaths(deps.depIncludePaths), deps.depSystemIncludePaths...))...)
-
-	// Collect generated headers from C dependencies.
-	ret = append(ret, cc.GlobGeneratedHeadersForSnapshot(ctx, deps.depGeneratedHeaders)...)
-
-	// TODO(185577950): If support for generated headers is added, they need to be collected here as well.
-	l.collectedSnapshotHeaders = ret
-}
diff --git a/rust/rust.go b/rust/rust.go
index 7d81c72..c4b89d5 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -30,7 +30,6 @@
 	"android/soong/fuzz"
 	"android/soong/multitree"
 	"android/soong/rust/config"
-	"android/soong/snapshot"
 )
 
 var pctx = android.NewPackageContext("android/soong/rust")
@@ -971,14 +970,6 @@
 			ctx.CheckbuildFile(mod.docTimestampFile.Path())
 		}
 
-		// glob exported headers for snapshot, if BOARD_VNDK_VERSION is current or
-		// RECOVERY_SNAPSHOT_VERSION is current.
-		if lib, ok := mod.compiler.(snapshotLibraryInterface); ok {
-			if cc.ShouldCollectHeadersForSnapshot(ctx, mod, apexInfo) {
-				lib.collectHeadersForSnapshot(ctx, deps)
-			}
-		}
-
 		apexInfo, _ := android.ModuleProvider(actx, android.ApexInfoProvider)
 		if !proptools.BoolDefault(mod.Installable(), mod.EverInstallable()) && !mod.ProcMacro() {
 			// If the module has been specifically configure to not be installed then
@@ -1124,6 +1115,11 @@
 	return nil
 }
 
+func (mod *Module) Symlinks() []string {
+	// TODO update this to return the list of symlinks when Rust supports defining symlinks
+	return nil
+}
+
 func rustMakeLibName(ctx android.ModuleContext, c cc.LinkableInterface, dep cc.LinkableInterface, depName string) string {
 	if rustDep, ok := dep.(*Module); ok {
 		// Use base module name for snapshots when exporting to Makefile.
@@ -1544,7 +1540,6 @@
 
 	deps := mod.deps(ctx)
 	var commonDepVariations []blueprint.Variation
-	var snapshotInfo *cc.SnapshotInfo
 
 	apiImportInfo := cc.GetApiImports(mod, actx)
 	if mod.usePublicApi() || mod.useVendorApi() {
@@ -1554,7 +1549,7 @@
 	}
 
 	if ctx.Os() == android.Android {
-		deps.SharedLibs, _ = cc.RewriteLibs(mod, &snapshotInfo, actx, ctx.Config(), deps.SharedLibs)
+		deps.SharedLibs, _ = cc.FilterNdkLibs(mod, ctx.Config(), deps.SharedLibs)
 	}
 
 	stdLinkage := "dylib-std"
@@ -1573,15 +1568,13 @@
 	rlibDepVariations = append(rlibDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: rlibVariation})
 	for _, lib := range deps.Rlibs {
 		depTag := rlibDepTag
-		lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Rlibs)
-
 		actx.AddVariationDependencies(rlibDepVariations, depTag, lib)
 	}
 
 	// dylibs
 	dylibDepVariations := append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: dylibVariation})
 	for _, lib := range deps.Dylibs {
-		addDylibDependency(actx, lib, mod, &snapshotInfo, dylibDepVariations, dylibDepTag)
+		actx.AddVariationDependencies(dylibDepVariations, dylibDepTag, lib)
 	}
 
 	// rustlibs
@@ -1591,7 +1584,8 @@
 				autoDep := mod.compiler.(autoDeppable).autoDep(ctx)
 				if autoDep.depTag == rlibDepTag {
 					// Handle the rlib deptag case
-					addRlibDependency(actx, lib, mod, &snapshotInfo, rlibDepVariations)
+					actx.AddVariationDependencies(rlibDepVariations, rlibDepTag, lib)
+
 				} else {
 					// autoDep.depTag is a dylib depTag. Not all rustlibs may be available as a dylib however.
 					// Check for the existence of the dylib deptag variant. Select it if available,
@@ -1599,23 +1593,22 @@
 					autoDepVariations := append(commonDepVariations,
 						blueprint.Variation{Mutator: "rust_libraries", Variation: autoDep.variation})
 
-					replacementLib := cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Dylibs)
+					if actx.OtherModuleDependencyVariantExists(autoDepVariations, lib) {
+						actx.AddVariationDependencies(autoDepVariations, autoDep.depTag, lib)
 
-					if actx.OtherModuleDependencyVariantExists(autoDepVariations, replacementLib) {
-						addDylibDependency(actx, lib, mod, &snapshotInfo, autoDepVariations, autoDep.depTag)
 					} else {
 						// If there's no dylib dependency available, try to add the rlib dependency instead.
-						addRlibDependency(actx, lib, mod, &snapshotInfo, rlibDepVariations)
+						actx.AddVariationDependencies(rlibDepVariations, rlibDepTag, lib)
+
 					}
 				}
 			}
 		} else if _, ok := mod.sourceProvider.(*protobufDecorator); ok {
 			for _, lib := range deps.Rustlibs {
-				replacementLib := cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Dylibs)
 				srcProviderVariations := append(commonDepVariations,
 					blueprint.Variation{Mutator: "rust_libraries", Variation: "source"})
 
-				if actx.OtherModuleDependencyVariantExists(srcProviderVariations, replacementLib) {
+				if actx.OtherModuleDependencyVariantExists(srcProviderVariations, lib) {
 					actx.AddVariationDependencies(srcProviderVariations, sourceDepTag, lib)
 				}
 			}
@@ -1626,13 +1619,13 @@
 	if deps.Stdlibs != nil {
 		if mod.compiler.stdLinkage(ctx) == RlibLinkage {
 			for _, lib := range deps.Stdlibs {
-				lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Rlibs)
 				actx.AddVariationDependencies(append(commonDepVariations, []blueprint.Variation{{Mutator: "rust_libraries", Variation: "rlib"}}...),
 					rlibDepTag, lib)
 			}
 		} else {
 			for _, lib := range deps.Stdlibs {
-				addDylibDependency(actx, lib, mod, &snapshotInfo, dylibDepVariations, dylibDepTag)
+				actx.AddVariationDependencies(dylibDepVariations, dylibDepTag, lib)
+
 			}
 		}
 	}
@@ -1657,7 +1650,6 @@
 
 	for _, lib := range deps.WholeStaticLibs {
 		depTag := cc.StaticDepTag(true)
-		lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).StaticLibs)
 
 		actx.AddVariationDependencies([]blueprint.Variation{
 			{Mutator: "link", Variation: "static"},
@@ -1666,7 +1658,6 @@
 
 	for _, lib := range deps.StaticLibs {
 		depTag := cc.StaticDepTag(false)
-		lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).StaticLibs)
 
 		actx.AddVariationDependencies([]blueprint.Variation{
 			{Mutator: "link", Variation: "static"},
@@ -1677,12 +1668,10 @@
 
 	crtVariations := cc.GetCrtVariations(ctx, mod)
 	for _, crt := range deps.CrtBegin {
-		actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag,
-			cc.GetReplaceModuleName(crt, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects))
+		actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag, crt)
 	}
 	for _, crt := range deps.CrtEnd {
-		actx.AddVariationDependencies(crtVariations, cc.CrtEndDepTag,
-			cc.GetReplaceModuleName(crt, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects))
+		actx.AddVariationDependencies(crtVariations, cc.CrtEndDepTag, crt)
 	}
 
 	if mod.sourceProvider != nil {
@@ -1705,17 +1694,6 @@
 	mod.afdo.addDep(ctx, actx)
 }
 
-// addRlibDependency will add an rlib dependency, rewriting to the snapshot library if available.
-func addRlibDependency(actx android.BottomUpMutatorContext, lib string, mod *Module, snapshotInfo **cc.SnapshotInfo, variations []blueprint.Variation) {
-	lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, snapshotInfo, actx).Rlibs)
-	actx.AddVariationDependencies(variations, rlibDepTag, lib)
-}
-
-func addDylibDependency(actx android.BottomUpMutatorContext, lib string, mod *Module, snapshotInfo **cc.SnapshotInfo, variations []blueprint.Variation, depTag dependencyTag) {
-	lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, snapshotInfo, actx).Dylibs)
-	actx.AddVariationDependencies(variations, depTag, lib)
-}
-
 func BeginMutator(ctx android.BottomUpMutatorContext) {
 	if mod, ok := ctx.Module().(*Module); ok && mod.Enabled() {
 		mod.beginMutator(ctx)
@@ -1747,7 +1725,6 @@
 }
 
 var _ android.HostToolProvider = (*Module)(nil)
-var _ snapshot.RelativeInstallPath = (*Module)(nil)
 
 func (mod *Module) HostToolPath() android.OptionalPath {
 	if !mod.Host() {
diff --git a/rust/sanitize.go b/rust/sanitize.go
index 3c08cd8..bfd3971 100644
--- a/rust/sanitize.go
+++ b/rust/sanitize.go
@@ -267,12 +267,6 @@
 			if Bool(mod.sanitize.Properties.Sanitize.Diag.Memtag_heap) {
 				noteDep = "note_memtag_heap_sync"
 			}
-			// If we're using snapshots, redirect to snapshot whenever possible
-			// TODO(b/178470649): clean manual snapshot redirections
-			snapshot, _ := android.ModuleProvider(mctx, cc.SnapshotInfoProvider)
-			if lib, ok := snapshot.StaticLibs[noteDep]; ok {
-				noteDep = lib
-			}
 			depTag := cc.StaticDepTag(true)
 			variations := append(mctx.Target().Variations(),
 				blueprint.Variation{Mutator: "link", Variation: "static"})
diff --git a/rust/snapshot_prebuilt.go b/rust/snapshot_prebuilt.go
deleted file mode 100644
index 42e3cef..0000000
--- a/rust/snapshot_prebuilt.go
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright 2021 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package rust
-
-import (
-	"fmt"
-
-	"android/soong/android"
-	"android/soong/cc"
-
-	"github.com/google/blueprint/proptools"
-)
-
-type snapshotLibraryDecorator struct {
-	cc.BaseSnapshotDecorator
-	*libraryDecorator
-	properties          cc.SnapshotLibraryProperties
-	sanitizerProperties struct {
-		SanitizerVariation cc.SanitizerType `blueprint:"mutated"`
-
-		//TODO: Library flags for cfi variant when CFI is supported.
-		//Cfi cc.SnapshotLibraryProperties `android:"arch_variant"`
-
-		// Library flags for hwasan variant.
-		Hwasan cc.SnapshotLibraryProperties `android:"arch_variant"`
-	}
-}
-
-var _ cc.SnapshotSanitizer = (*snapshotLibraryDecorator)(nil)
-
-func (library *snapshotLibraryDecorator) IsSanitizerAvailable(t cc.SanitizerType) bool {
-	switch t {
-	//TODO: When CFI is supported, add a check here as well
-	case cc.Hwasan:
-		return library.sanitizerProperties.Hwasan.Src != nil
-	default:
-		return false
-	}
-}
-
-func (library *snapshotLibraryDecorator) SetSanitizerVariation(t cc.SanitizerType, enabled bool) {
-	if !enabled || library.IsSanitizerEnabled(t) {
-		return
-	}
-	if !library.IsUnsanitizedVariant() {
-		panic(fmt.Errorf("snapshot Sanitizer must be one of Cfi or Hwasan but not both"))
-	}
-	library.sanitizerProperties.SanitizerVariation = t
-}
-
-func (library *snapshotLibraryDecorator) IsSanitizerEnabled(t cc.SanitizerType) bool {
-	return library.sanitizerProperties.SanitizerVariation == t
-}
-
-func (library *snapshotLibraryDecorator) IsUnsanitizedVariant() bool {
-	//TODO: When CFI is supported, add a check here as well
-	return !library.IsSanitizerEnabled(cc.Hwasan)
-}
-
-func init() {
-	registerRustSnapshotModules(android.InitRegistrationContext)
-}
-
-func (mod *Module) IsSnapshotSanitizerAvailable(t cc.SanitizerType) bool {
-	if ss, ok := mod.compiler.(cc.SnapshotSanitizer); ok {
-		return ss.IsSanitizerAvailable(t)
-	}
-	return false
-}
-
-func (mod *Module) SetSnapshotSanitizerVariation(t cc.SanitizerType, enabled bool) {
-	if ss, ok := mod.compiler.(cc.SnapshotSanitizer); ok {
-		ss.SetSanitizerVariation(t, enabled)
-	} else {
-		panic(fmt.Errorf("Calling SetSnapshotSanitizerVariation on a non-snapshotLibraryDecorator: %s", mod.Name()))
-	}
-}
-
-func (mod *Module) IsSnapshotUnsanitizedVariant() bool {
-	if ss, ok := mod.compiler.(cc.SnapshotSanitizer); ok {
-		return ss.IsUnsanitizedVariant()
-	}
-	return false
-}
-
-func (mod *Module) IsSnapshotSanitizer() bool {
-	if _, ok := mod.compiler.(cc.SnapshotSanitizer); ok {
-		return true
-	}
-	return false
-}
-
-func registerRustSnapshotModules(ctx android.RegistrationContext) {
-	cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
-		"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
-	cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
-		"vendor_snapshot_dylib", VendorSnapshotDylibFactory)
-	cc.RecoverySnapshotImageSingleton.RegisterAdditionalModule(ctx,
-		"recovery_snapshot_rlib", RecoverySnapshotRlibFactory)
-}
-
-func snapshotLibraryFactory(image cc.SnapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
-	module, library := NewRustLibrary(android.DeviceSupported)
-
-	module.sanitize = nil
-	library.stripper.StripProperties.Strip.None = proptools.BoolPtr(true)
-
-	prebuilt := &snapshotLibraryDecorator{
-		libraryDecorator: library,
-	}
-
-	module.compiler = prebuilt
-
-	prebuilt.Init(module, image, moduleSuffix)
-	module.AddProperties(
-		&prebuilt.properties,
-		&prebuilt.sanitizerProperties,
-	)
-
-	return module, prebuilt
-}
-
-func (library *snapshotLibraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) buildOutput {
-	var variant string
-	if library.static() {
-		variant = cc.SnapshotStaticSuffix
-	} else if library.shared() {
-		variant = cc.SnapshotSharedSuffix
-	} else if library.rlib() {
-		variant = cc.SnapshotRlibSuffix
-	} else if library.dylib() {
-		variant = cc.SnapshotDylibSuffix
-	}
-
-	library.SetSnapshotAndroidMkSuffix(ctx, variant)
-
-	if library.IsSanitizerEnabled(cc.Hwasan) {
-		library.properties = library.sanitizerProperties.Hwasan
-	}
-	if !library.MatchesWithDevice(ctx.DeviceConfig()) {
-		return buildOutput{}
-	}
-	outputFile := android.PathForModuleSrc(ctx, *library.properties.Src)
-	library.unstrippedOutputFile = outputFile
-	return buildOutput{outputFile: outputFile}
-}
-
-func (library *snapshotLibraryDecorator) rustdoc(ctx ModuleContext, flags Flags, deps PathDeps) android.OptionalPath {
-	return android.OptionalPath{}
-}
-
-// vendor_snapshot_rlib is a special prebuilt rlib library which is auto-generated by
-// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_rlib
-// overrides the vendor variant of the rust rlib library with the same name, if BOARD_VNDK_VERSION
-// is set.
-func VendorSnapshotRlibFactory() android.Module {
-	module, prebuilt := snapshotLibraryFactory(cc.VendorSnapshotImageSingleton, cc.SnapshotRlibSuffix)
-	prebuilt.libraryDecorator.BuildOnlyRlib()
-	prebuilt.libraryDecorator.setNoStdlibs()
-	return module.Init()
-}
-
-// vendor_snapshot_dylib is a special prebuilt dylib library which is auto-generated by
-// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_dylib
-// overrides the vendor variant of the rust dylib library with the same name, if BOARD_VNDK_VERSION
-// is set.
-func VendorSnapshotDylibFactory() android.Module {
-	module, prebuilt := snapshotLibraryFactory(cc.VendorSnapshotImageSingleton, cc.SnapshotDylibSuffix)
-	prebuilt.libraryDecorator.BuildOnlyDylib()
-	prebuilt.libraryDecorator.setNoStdlibs()
-	return module.Init()
-}
-
-func RecoverySnapshotRlibFactory() android.Module {
-	module, prebuilt := snapshotLibraryFactory(cc.RecoverySnapshotImageSingleton, cc.SnapshotRlibSuffix)
-	prebuilt.libraryDecorator.BuildOnlyRlib()
-	prebuilt.libraryDecorator.setNoStdlibs()
-	return module.Init()
-}
-
-func (library *snapshotLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
-	arches := config.Arches()
-	if len(arches) == 0 || arches[0].ArchType.String() != library.Arch() {
-		return false
-	}
-	if library.properties.Src == nil {
-		return false
-	}
-	return true
-}
-
-func (library *snapshotLibraryDecorator) IsSnapshotPrebuilt() bool {
-	return true
-}
-
-var _ cc.SnapshotInterface = (*snapshotLibraryDecorator)(nil)
diff --git a/rust/snapshot_utils.go b/rust/snapshot_utils.go
deleted file mode 100644
index 55c85e6..0000000
--- a/rust/snapshot_utils.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2021 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package rust
-
-import (
-	"android/soong/android"
-)
-
-// snapshotLibraryInterface is an interface for libraries captured to VNDK / vendor snapshots.
-type snapshotLibraryInterface interface {
-	libraryInterface
-
-	// collectHeadersForSnapshot is called in GenerateAndroidBuildActions for snapshot aware
-	// modules (See isSnapshotAware below).
-	// This function should gather all headers needed for snapshot.
-	collectHeadersForSnapshot(ctx android.ModuleContext, deps PathDeps)
-
-	// snapshotHeaders should return collected headers by collectHeadersForSnapshot.
-	// Calling snapshotHeaders before collectHeadersForSnapshot is an error.
-	snapshotHeaders() android.Paths
-}
-
-func (mod *Module) ExcludeFromVendorSnapshot() bool {
-	return Bool(mod.Properties.Exclude_from_vendor_snapshot)
-}
-
-func (mod *Module) ExcludeFromRecoverySnapshot() bool {
-	return Bool(mod.Properties.Exclude_from_recovery_snapshot)
-}
-
-func (mod *Module) IsSnapshotLibrary() bool {
-	if lib, ok := mod.compiler.(libraryInterface); ok {
-		return lib.shared() || lib.static() || lib.rlib() || lib.dylib()
-	}
-	return false
-}
-
-func (mod *Module) SnapshotRuntimeLibs() []string {
-	// TODO Rust does not yet support a runtime libs notion similar to CC
-	return []string{}
-}
-
-func (mod *Module) SnapshotSharedLibs() []string {
-	return mod.Properties.SnapshotSharedLibs
-}
-
-func (mod *Module) SnapshotStaticLibs() []string {
-	return mod.Properties.SnapshotStaticLibs
-}
-
-func (mod *Module) SnapshotRlibs() []string {
-	return mod.Properties.SnapshotRlibs
-}
-
-func (mod *Module) SnapshotDylibs() []string {
-	return mod.Properties.SnapshotDylibs
-}
-
-func (mod *Module) Symlinks() []string {
-	// TODO update this to return the list of symlinks when Rust supports defining symlinks
-	return nil
-}
-
-func (m *Module) SnapshotHeaders() android.Paths {
-	if l, ok := m.compiler.(snapshotLibraryInterface); ok {
-		return l.snapshotHeaders()
-	}
-	return android.Paths{}
-}
diff --git a/rust/testing.go b/rust/testing.go
index 4e9a6c6..5837dcc 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -197,5 +197,4 @@
 	ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
 		ctx.BottomUp("rust_sanitizers", rustSanitizerRuntimeMutator).Parallel()
 	})
-	registerRustSnapshotModules(ctx)
 }