summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2024-05-09 15:00:47 -0700
committerChris Wailes <chriswailes@google.com>2024-05-09 15:00:47 -0700
commitcdb8b409a4da676531650f644d032308ab1c0cd8 (patch)
treea02e9cf3b29985eab8a9388a423157ecdc6f0ebd
parent3a4ae2e7c3cf7d7bb52311611e05ebf1bcab34b5 (diff)
downloadpercent-encoding-cdb8b409a4da676531650f644d032308ab1c0cd8.tar.gz
Ensure crate is compiled with std for panic handler
This CL adds a patch to use `extern crate std` to ensure that a panic handler is available when the crate is compiled as a dylib. Test: m libpercent_encoding Bug: 333887339 Change-Id: I38f91e3b99f483b0f248ac95ba1f6aaaa64762d0
-rw-r--r--patches/std.diff14
-rw-r--r--src/lib.rs3
2 files changed, 17 insertions, 0 deletions
diff --git a/patches/std.diff b/patches/std.diff
new file mode 100644
index 0000000..76feb4e
--- /dev/null
+++ b/patches/std.diff
@@ -0,0 +1,14 @@
+diff --git a/src/lib.rs b/src/lib.rs
+index 46a5d74..21d8a61 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -41,6 +41,9 @@
+ #[cfg(feature = "alloc")]
+ extern crate alloc;
+
++#[cfg(android_dylib)]
++extern crate std;
++
+ #[cfg(feature = "alloc")]
+ use alloc::{
+ borrow::{Cow, ToOwned},
diff --git a/src/lib.rs b/src/lib.rs
index 46a5d74..21d8a61 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -41,6 +41,9 @@
#[cfg(feature = "alloc")]
extern crate alloc;
+#[cfg(android_dylib)]
+extern crate std;
+
#[cfg(feature = "alloc")]
use alloc::{
borrow::{Cow, ToOwned},