Revert^4 "rust: Only allow bindgen to produce `rlib`s."

199c18850233f3d07f65c7be3bfa70878cc6c345

Change-Id: I28b353fa89354cc572806b2274169342a473a03c
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 72cc894..0199d3a 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -299,7 +299,15 @@
 		ClangProperties:    cc.RustBindgenClangProperties{},
 	}
 
-	module := NewSourceProviderModule(hod, bindgen, false)
+	module := NewSourceProviderModule(hod, bindgen, false, true)
+
+	android.AddLoadHook(module, func(ctx android.LoadHookContext) {
+		type stub_props struct {
+			Visibility []string
+		}
+		props := &stub_props{[]string{":__subpackages__"}}
+		ctx.PrependProperties(props)
+	})
 
 	return module, bindgen
 }