diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-17 02:46:21 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-17 02:46:21 +0000 |
commit | 782886f1c4dced51e80445b8790b521d7a242a30 (patch) | |
tree | 36bc3873a07934dd7d5791d7bcadf34d97f2e051 | |
parent | fbd15b739b7f455b9bc3a9d67be6572471b33282 (diff) | |
parent | 073d05ba30ead6dd7d7ce29d27bc30556be6b9b0 (diff) | |
download | memoffset-782886f1c4dced51e80445b8790b521d7a242a30.tar.gz |
Snap for 8192738 from 073d05ba30ead6dd7d7ce29d27bc30556be6b9b0 to tm-frc-documentsui-release
Change-Id: I22d7e7a5323f00acec1f3ed5dfc938cd3706c2c8
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 37 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 8 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | TEST_MAPPING | 95 | ||||
-rw-r--r-- | cargo2android.json | 12 | ||||
-rw-r--r-- | patches/Android.bp.patch | 14 | ||||
-rw-r--r-- | src/lib.rs | 3 | ||||
-rw-r--r-- | src/offset_of.rs | 12 |
11 files changed, 137 insertions, 54 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index fcba615..036fbbe 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "9846cd17f381a5a9b478267ca5c684ab59346283" + "sha1": "bbd58f2cbe92d3424d8c3161c46dd5d022c30437" } } @@ -22,6 +22,8 @@ rust_library { name: "libmemoffset", host_supported: true, crate_name: "memoffset", + cargo_env_compat: true, + cargo_pkg_version: "0.6.4", srcs: ["src/lib.rs"], edition: "2015", features: ["default"], @@ -34,16 +36,26 @@ rust_library { ], apex_available: [ "//apex_available:platform", + "com.android.bluetooth", + "com.android.compos", "com.android.virt", ], + vendor_available: true, + min_sdk_version: "29", } -rust_defaults { - name: "memoffset_defaults", +rust_test { + name: "memoffset_test_src_lib", + host_supported: true, crate_name: "memoffset", + cargo_env_compat: true, + cargo_pkg_version: "0.6.4", srcs: ["src/lib.rs"], test_suites: ["general-tests"], auto_gen_config: true, + test_options: { + unit_test: true, + }, edition: "2015", features: ["default"], cfgs: [ @@ -53,25 +65,4 @@ rust_defaults { "raw_ref_macros", "tuple_ty", ], - rustlibs: [ - // ANDROID: disable for now just to avoid another dependency. - //"libdoc_comment", - ], } - -rust_test_host { - name: "memoffset_host_test_src_lib", - defaults: ["memoffset_defaults"], - test_options: { - unit_test: true, - }, -} - -rust_test { - name: "memoffset_device_test_src_lib", - defaults: ["memoffset_defaults"], -} - -// dependent_library ["feature_list"] -// autocfg-1.0.1 -// doc-comment-0.3.3 @@ -12,7 +12,7 @@ [package] name = "memoffset" -version = "0.6.3" +version = "0.6.4" authors = ["Gilad Naaman <gilad.naaman@gmail.com>"] description = "offset_of functionality for Rust structs." readme = "README.md" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 9299a64..d3acd0b 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "memoffset" -version = "0.6.3" +version = "0.6.4" authors = ["Gilad Naaman <gilad.naaman@gmail.com>"] description = "offset_of functionality for Rust structs." license = "MIT" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/memoffset/memoffset-0.6.3.crate" + value: "https://static.crates.io/crates/memoffset/memoffset-0.6.4.crate" } - version: "0.6.3" + version: "0.6.4" license_type: NOTICE last_upgrade_date { year: 2021 - month: 4 - day: 8 + month: 6 + day: 21 } } @@ -69,7 +69,5 @@ features = ["unstable_const"] Your crate root: (`lib.rs`/`main.rs`) ```rust,ignore -#![feature(ptr_offset_from, const_ptr_offset_from, const_maybe_uninit_as_ptr, const_raw_ptr_deref)] +#![feature(const_ptr_offset_from, const_maybe_uninit_as_ptr, const_raw_ptr_deref, const_refs_to_cell)] ``` - -If you intend to use `offset_of!` inside a `const fn`, also add the `const_fn` compiler feature. diff --git a/TEST_MAPPING b/TEST_MAPPING index 71c00fc..eceec2f 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -1,11 +1,102 @@ // Generated by update_crate_tests.py for tests that depend on this crate. { + "imports": [ + { + "path": "external/rust/crates/base64" + }, + { + "path": "external/rust/crates/crossbeam-deque" + }, + { + "path": "external/rust/crates/crossbeam-epoch" + }, + { + "path": "external/rust/crates/tinytemplate" + }, + { + "path": "external/rust/crates/tinyvec" + }, + { + "path": "external/rust/crates/tokio" + }, + { + "path": "external/rust/crates/unicode-xid" + } + ], "presubmit": [ { - "name": "crossbeam-epoch_device_test_src_lib" + "name": "ZipFuseTest" + }, + { + "name": "apkdmverity.test" + }, + { + "name": "authfs_device_test_src_lib" + }, + { + "name": "keystore2_crypto_test_rust" + }, + { + "name": "keystore2_selinux_concurrency_test" + }, + { + "name": "keystore2_test" + }, + { + "name": "keystore2_test_utils_test" + }, + { + "name": "legacykeystore_test" + }, + { + "name": "memoffset_test_src_lib" + }, + { + "name": "microdroid_manager_test" + }, + { + "name": "open_then_run_module" + }, + { + "name": "virtualizationservice_device_test" + } + ], + "presubmit-rust": [ + { + "name": "ZipFuseTest" + }, + { + "name": "apkdmverity.test" + }, + { + "name": "authfs_device_test_src_lib" + }, + { + "name": "keystore2_crypto_test_rust" + }, + { + "name": "keystore2_selinux_concurrency_test" + }, + { + "name": "keystore2_test" + }, + { + "name": "keystore2_test_utils_test" + }, + { + "name": "legacykeystore_test" + }, + { + "name": "memoffset_test_src_lib" + }, + { + "name": "microdroid_manager_test" + }, + { + "name": "open_then_run_module" }, { - "name": "memoffset_device_test_src_lib" + "name": "virtualizationservice_device_test" } ] } diff --git a/cargo2android.json b/cargo2android.json index 0f253f0..5654962 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -1,11 +1,17 @@ { "apex-available": [ "//apex_available:platform", + "com.android.bluetooth", + "com.android.compos", "com.android.virt" ], "dependencies": true, + "dependency-blocklist": [ + "doc_comment" + ], "device": true, - "patch": "patches/Android.bp.patch", + "min-sdk-version": "29", "run": true, - "tests": true -}
\ No newline at end of file + "tests": true, + "vendor-available": true +} diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch deleted file mode 100644 index 96c3e12..0000000 --- a/patches/Android.bp.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/Android.bp b/Android.bp -index eb63f7c..efa8362 100644 ---- a/Android.bp -+++ b/Android.bp -@@ -48,7 +52,8 @@ rust_defaults { - "--cfg tuple_ty", - ], - rustlibs: [ -- "libdoc_comment", -+ // ANDROID: disable for now just to avoid another dependency. -+ //"libdoc_comment", - ], - } - @@ -61,11 +61,10 @@ #![cfg_attr( feature = "unstable_const", feature( - ptr_offset_from, - const_fn, const_ptr_offset_from, const_maybe_uninit_as_ptr, const_raw_ptr_deref, + const_refs_to_cell, ) )] diff --git a/src/offset_of.rs b/src/offset_of.rs index a363d30..d376498 100644 --- a/src/offset_of.rs +++ b/src/offset_of.rs @@ -255,6 +255,18 @@ mod tests { #[cfg(feature = "unstable_const")] #[test] + fn const_offset_interior_mutable() { + #[repr(C)] + struct Foo { + a: u32, + b: core::cell::Cell<u32>, + } + + assert_eq!([0; offset_of!(Foo, b)].len(), 4); + } + + #[cfg(feature = "unstable_const")] + #[test] fn const_fn_offset() { const fn test_fn() -> usize { #[repr(C)] |