aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Walbran <qwandor@google.com>2022-03-30 19:30:11 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-30 19:30:11 +0000
commitfdd63d2fda6113676b0fc697020b5eea7934074c (patch)
tree2393cab2d6fc52727bf365f0b2e300b32f0585f9
parentde05122fa19635560828522475da62cb8a688ac4 (diff)
parenta14c0f13e4aaedf1fa770a256a62121da43d50d1 (diff)
downloadbitflags-fdd63d2fda6113676b0fc697020b5eea7934074c.tar.gz
Don't add std dependency when building rlib. am: ab2400dbd9 am: e6427cd03c am: 4eab12190c am: a14c0f13e4
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/bitflags/+/2036445 Change-Id: I09f1cf5229666dcb4391cb0e1dee166e80c50b33 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--patches/std.diff17
-rw-r--r--src/lib.rs7
2 files changed, 10 insertions, 14 deletions
diff --git a/patches/std.diff b/patches/std.diff
index c2ccaee..a34fe97 100644
--- a/patches/std.diff
+++ b/patches/std.diff
@@ -1,15 +1,14 @@
diff --git a/src/lib.rs b/src/lib.rs
-index 935e432..36c0699 100644
+index 935e432..7e87795 100644
--- a/src/lib.rs
+++ b/src/lib.rs
-@@ -278,6 +278,10 @@
- #![cfg_attr(not(test), no_std)]
+@@ -275,7 +275,8 @@
+ //!
+ //! Users should generally avoid defining a flag with a value of zero.
+
+-#![cfg_attr(not(test), no_std)]
++// ANDROID: Use std to allow building as a dylib.
++#![cfg_attr(not(any(test, android_dylib)), no_std)]
#![doc(html_root_url = "https://docs.rs/bitflags/1.3.2")]
-+// ANDROID: Unconditionally use std to allow building as a dylib
-+#[macro_use]
-+extern crate std;
-+
#[doc(hidden)]
- pub extern crate core as _core;
-
diff --git a/src/lib.rs b/src/lib.rs
index 36c0699..7e87795 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -275,13 +275,10 @@
//!
//! Users should generally avoid defining a flag with a value of zero.
-#![cfg_attr(not(test), no_std)]
+// ANDROID: Use std to allow building as a dylib.
+#![cfg_attr(not(any(test, android_dylib)), no_std)]
#![doc(html_root_url = "https://docs.rs/bitflags/1.3.2")]
-// ANDROID: Unconditionally use std to allow building as a dylib
-#[macro_use]
-extern crate std;
-
#[doc(hidden)]
pub extern crate core as _core;