diff options
author | Andrew Walbran <qwandor@google.com> | 2022-03-22 13:41:49 +0000 |
---|---|---|
committer | Andrew Walbran <qwandor@google.com> | 2022-03-30 15:14:59 +0000 |
commit | ab2400dbd96b5b5c19d6c425c4d8c39ab74c2d38 (patch) | |
tree | 2393cab2d6fc52727bf365f0b2e300b32f0585f9 | |
parent | 90125b4ea7ff80f0a8ced9f1c86723ed4dddc6d0 (diff) | |
download | bitflags-ab2400dbd96b5b5c19d6c425c4d8c39ab74c2d38.tar.gz |
Don't add std dependency when building rlib.
We need to be able to use this crate in no_std binaries.
Bug: 168927099
Test: atest -c -m .
Change-Id: I4402ef9c5b6089fd495e8343460d9fd459560202
-rw-r--r-- | patches/std.diff | 17 | ||||
-rw-r--r-- | src/lib.rs | 7 |
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; - @@ -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; |