diff options
author | Sergii Parubochyi <sergiip@google.com> | 2023-10-23 19:20:45 +1100 |
---|---|---|
committer | Sergii Parubochyi <sergiip@google.com> | 2023-10-24 10:56:00 +1100 |
commit | 8892fec2cdc9e09795522ba1c007fa78b12f881c (patch) | |
tree | e4b39e013ea4fafe1f20308134f2fb6e4bb7ee24 | |
parent | bc9dc6a310975d1d5386d229bd63a1496cc88685 (diff) | |
download | untrusted-8892fec2cdc9e09795522ba1c007fa78b12f881c.tar.gz |
Add condition for using std only for dylib
Crates that can be nostd (ring, libgbl) would be able not to have std.
Test: mma
Change-Id: Ife51edfe24caf0a084975988d4ab2a6cd451071e
-rw-r--r-- | patches/std.diff | 3 | ||||
-rw-r--r-- | src/untrusted.rs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/patches/std.diff b/patches/std.diff index e3ebe5e..9d110cc 100644 --- a/patches/std.diff +++ b/patches/std.diff @@ -6,7 +6,8 @@ index 2f88bb4..b9f1439 100644 )] #![no_std] -+// ANDROID: Unconditionally use std to allow building as a dylib. ++// ANDROID: use std to allow building as a dylib. ++#[cfg(android_dylib)] +extern crate std; + /// A wrapper around `&'a [u8]` that helps in writing panic-free code. diff --git a/src/untrusted.rs b/src/untrusted.rs index 5071fdd..47c281e 100644 --- a/src/untrusted.rs +++ b/src/untrusted.rs @@ -105,7 +105,8 @@ #![allow(rustdoc::bare_urls)] #![no_std] -// ANDROID: Unconditionally use std to allow building as a dylib. +// ANDROID: use std to allow building as a dylib. +#[cfg(android_dylib)] extern crate std; /// A wrapper around `&'a [u8]` that helps in writing panic-free code. |