aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Clément Tosi <ptosi@google.com>2022-11-25 17:42:41 +0000
committerPierre-Clément Tosi <ptosi@google.com>2022-11-25 18:11:34 +0000
commit7388ef014620436064aa9e87f50f2f6c5e153f5a (patch)
tree94b0b9e937fc6fe363cbf7147ae86d656cc6dd3a
parent483f46228ded54aec62d5eb2eba69415a24c9c7d (diff)
downloadtinyvec-7388ef014620436064aa9e87f50f2f6c5e153f5a.tar.gz
Enable upstream feature 'std'
Instead of force-patching lib.rs, remove the ![no_std] attribute through the upstream feature 'std', which was added in 1.5.0 [1]. Update Android.bp by running cargo2android.py. [1]: https://github.com/Lokathor/tinyvec/pull/152 Test: TH Change-Id: Idea781c1ad3f8a4b1ebec7c651b7081feff581ff
-rw-r--r--Android.bp33
-rw-r--r--cargo2android.json2
-rw-r--r--patches/std.diff14
-rw-r--r--src/lib.rs3
4 files changed, 26 insertions, 26 deletions
diff --git a/Android.bp b/Android.bp
index 3888f8c..3f35105 100644
--- a/Android.bp
+++ b/Android.bp
@@ -50,6 +50,7 @@ rust_library {
features: [
"alloc",
"default",
+ "std",
"tinyvec_macros",
],
rustlibs: [
@@ -62,22 +63,18 @@ rust_library {
min_sdk_version: "29",
}
-rust_test {
- name: "tinyvec_test_tests_arrayvec",
- host_supported: true,
- crate_name: "arrayvec",
+rust_defaults {
+ name: "tinyvec_test_defaults",
+ crate_name: "tinyvec",
cargo_env_compat: true,
cargo_pkg_version: "1.5.1",
- srcs: ["tests/arrayvec.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
- test_options: {
- unit_test: true,
- },
edition: "2018",
features: [
"alloc",
"default",
+ "std",
"tinyvec_macros",
],
rustlibs: [
@@ -88,3 +85,23 @@ rust_test {
"libtinyvec_macros",
],
}
+
+rust_test {
+ name: "tinyvec_test_tests_arrayvec",
+ defaults: ["tinyvec_test_defaults"],
+ host_supported: true,
+ srcs: ["tests/arrayvec.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "tinyvec_test_tests_tinyvec",
+ defaults: ["tinyvec_test_defaults"],
+ host_supported: true,
+ srcs: ["tests/tinyvec.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
diff --git a/cargo2android.json b/cargo2android.json
index 5974d19..a94ae9e 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -5,7 +5,7 @@
],
"dependencies": true,
"device": true,
- "features": "alloc,default,tinyvec_macros",
+ "features": "alloc,default,std,tinyvec_macros",
"min-sdk-version": "29",
"run": true,
"tests": true
diff --git a/patches/std.diff b/patches/std.diff
deleted file mode 100644
index 36d5c7d..0000000
--- a/patches/std.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/src/lib.rs b/src/lib.rs
-index c26f0c5..ce06601 100644
---- a/src/lib.rs
-+++ b/src/lib.rs
-@@ -66,6 +66,9 @@
- //! the `Array` trait. The actual usage of the crate is not expected to break
- //! significantly in this transition.
-
-+// ANDROID: Unconditionally use std to allow building as a dylib.
-+extern crate std;
-+
- #[allow(unused_imports)]
- use core::{
- borrow::{Borrow, BorrowMut},
diff --git a/src/lib.rs b/src/lib.rs
index c66705d..87d96bb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -62,9 +62,6 @@
//! the `Array` trait. The actual usage of the crate is not expected to break
//! significantly in this transition.
-// ANDROID: Unconditionally use std to allow building as a dylib.
-extern crate std;
-
#[allow(unused_imports)]
use core::{
borrow::{Borrow, BorrowMut},