Skip to content

Commit 38d80eb

Browse files
committed
Fix unexpected-cfgs by adding api-level-30 feature and removing test
Some code copied from the NDK carried over the respective `feature` `cfg` guards, without ever adding the feature to the `[features]` list in `Cargo.toml`. Now that Rust detects these mishaps, we can fix it by removing `test` (bindings don't seem to be run-tested) and reexpose `ConfigurationRef::screen_round()` which was behind a previously unsettable `feature = "api-level-30"`. Also remove `unsafe impl Send/Sync for ConfigurationRef` since the upstream `ndk` already declares `Configuration` to be `Send` and `Sync`, and `RwLock` and `Arc` carry that through.
1 parent b90db7c commit 38d80eb

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

android-activity/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ rust-version = "1.69.0"
2727
default = []
2828
game-activity = []
2929
native-activity = []
30+
api-level-30 = ["ndk?/api-level-30"]
3031

3132
[dependencies]
3233
log = "0.4"

android-activity/src/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ impl PartialEq for ConfigurationRef {
2828
}
2929
}
3030
impl Eq for ConfigurationRef {}
31-
unsafe impl Send for ConfigurationRef {}
32-
unsafe impl Sync for ConfigurationRef {}
3331

3432
impl fmt::Debug for ConfigurationRef {
3533
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

android-activity/src/game_activity/ffi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ use jni_sys::*;
1616
use libc::{pthread_cond_t, pthread_mutex_t, pthread_t};
1717
use ndk_sys::{AAssetManager, AConfiguration, ALooper, ALooper_callbackFunc, ANativeWindow, ARect};
1818

19-
#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "arm"))]
19+
#[cfg(all(any(target_os = "android"), target_arch = "arm"))]
2020
include!("ffi_arm.rs");
2121

22-
#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "aarch64"))]
22+
#[cfg(all(any(target_os = "android"), target_arch = "aarch64"))]
2323
include!("ffi_aarch64.rs");
2424

25-
#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "x86"))]
25+
#[cfg(all(any(target_os = "android"), target_arch = "x86"))]
2626
include!("ffi_i686.rs");
2727

28-
#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "x86_64"))]
28+
#[cfg(all(any(target_os = "android"), target_arch = "x86_64"))]
2929
include!("ffi_x86_64.rs");

0 commit comments

Comments
 (0)