Snap for 8730993 from 746a9df534dfa538f6de73c5c206837590bed62f to mainline-tzdata3-release
Change-Id: Iac00555866c3215b0e1f2e1ee5f1b497ca4fbf73
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index b737620..fcba615 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "01e2e42ef0d833682c27b0f40a2cc748d86b2dc3"
+ "sha1": "9846cd17f381a5a9b478267ca5c684ab59346283"
}
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
deleted file mode 100644
index 97fcf98..0000000
--- a/.github/workflows/ci.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-name: CI
-
-on: [push, pull_request]
-
-jobs:
- test:
- name: Test Suite
- runs-on: ubuntu-latest
- strategy:
- matrix:
- rust:
- - stable
- - beta
- - nightly
- steps:
- - uses: actions/checkout@v2
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: ${{ matrix.rust }}
- override: true
- - name: Run cargo test
- run: cargo test
-
- test-msrv:
- name: Test Suite
- runs-on: ubuntu-latest
- strategy:
- matrix:
- rust:
- - 1.19.0 # Oldest supported (first version with numeric fields in struct patterns)
- - 1.20.0 # Oldest supported with tuple_ty
- - 1.31.0 # Oldest supported with allow(clippy)
- - 1.36.0 # Oldest supported with MaybeUninit
- - 1.40.0 # Oldest supported with cfg(doctest)
- - 1.51.0 # Oldest supported with ptr::addr_of!
- - stable
- - beta
- - nightly
- steps:
- - uses: actions/checkout@v2
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: ${{ matrix.rust }}
- override: true
- - name: Run cargo test
- # Exclude doctests here, as we don't want to clutter docs themselves
- # with backwards compatibility workarounds.
- run: cargo test --lib
-
- nightly:
- name: Test Suite (nightly features)
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: nightly
- override: true
- - name: Run cargo test
- # `--lib` prevents doctests from being run.
- # This is due to `unstable_const` requiring extra `feature(...)` directives
- # which the doctests do not have.
- run: cargo test --all-features --lib
-
- miri:
- name: Test Suite (Miri)
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Test with Miri
- run: ci/miri.sh
-
- style:
- name: lints and formatting
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.51.0 # pin a version for reproducible results
- components: rustfmt
- override: true
- - name: Check warnings
- run: RUSTFLAGS="-D warnings" cargo check --all-targets
- - name: Check formatting
- run: cargo fmt -- --check
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..d3c4d65
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,50 @@
+sudo: false
+language: rust
+cache:
+ cargo: true
+matrix:
+ include:
+ - name: miri
+ env: TRAVIS_MIRI_JOB # make sure the cache is not shared with other "nightly" jobs
+ rust: nightly
+ script:
+ - sh ci/miri.sh
+
+ - rust: 1.19.0 # Oldest supported (first version with numeric fields in struct patterns)
+ - rust: 1.20.0 # Oldest supported with tuple_ty
+ - rust: 1.31.0 # Oldest supported with allow(clippy)
+ - rust: 1.36.0 # Oldest supported with MaybeUninit
+ - rust: 1.40.0 # Oldest supported with cfg(doctest)
+ - rust: 1.51.0 # Oldest supported with ptr::addr_of!
+ - rust: stable
+ - rust: beta
+ - rust: nightly
+
+ - name: all-features
+ rust: nightly
+ script:
+ # `--lib` added to prevent doctests from being compiled.
+ # This is due to `unstable_const` requiring extra `feature(...)` directives
+ # which the doctests do not have.
+ - cargo test --verbose --all-features --lib
+
+ - name: rustfmt
+ rust: 1.36.0
+ install:
+ - rustup component add rustfmt
+ script:
+ - cargo fmt -- --check
+
+ - name: deny-warnings
+ env: RUSTFLAGS="-D warnings"
+ rust: 1.33.0 # `stable`: Locking down for consistent behavior
+ script:
+ - cargo check --tests
+
+install:
+- rustc -Vv
+- cargo -V
+
+script:
+- rm -rf target/debug/deps/*memoffset* # Avoid rustdoc problems
+- cargo test --verbose
diff --git a/Android.bp b/Android.bp
index c8a26b5..d53b9c9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,8 +22,6 @@
name: "libmemoffset",
host_supported: true,
crate_name: "memoffset",
- cargo_env_compat: true,
- cargo_pkg_version: "0.6.5",
srcs: ["src/lib.rs"],
edition: "2015",
features: ["default"],
@@ -36,26 +34,16 @@
],
apex_available: [
"//apex_available:platform",
- "com.android.bluetooth",
- "com.android.compos",
"com.android.virt",
],
- vendor_available: true,
- min_sdk_version: "29",
}
-rust_test {
- name: "memoffset_test_src_lib",
- host_supported: true,
+rust_defaults {
+ name: "memoffset_defaults",
crate_name: "memoffset",
- cargo_env_compat: true,
- cargo_pkg_version: "0.6.5",
srcs: ["src/lib.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
- test_options: {
- unit_test: true,
- },
edition: "2015",
features: ["default"],
cfgs: [
@@ -65,4 +53,25 @@
"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
diff --git a/Cargo.toml b/Cargo.toml
index 2874e31..e273757 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,15 +3,16 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
+# to registry (e.g., crates.io) dependencies
#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
[package]
name = "memoffset"
-version = "0.6.5"
+version = "0.6.3"
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 7a62858..9299a64 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "memoffset"
-version = "0.6.5"
+version = "0.6.3"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT"
diff --git a/METADATA b/METADATA
index 7b4d9f1..3e6b088 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/memoffset/memoffset-0.6.5.crate"
+ value: "https://static.crates.io/crates/memoffset/memoffset-0.6.3.crate"
}
- version: "0.6.5"
+ version: "0.6.3"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 3
- day: 1
+ year: 2021
+ month: 4
+ day: 8
}
}
diff --git a/README.md b/README.md
index 9e93c2b..a60f288 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# memoffset #
-[![](https://img.shields.io/crates/v/memoffset.svg)](https://crates.io/crates/memoffset)
+[![](http://meritbadge.herokuapp.com/memoffset)](https://crates.io/crates/memoffset)
C-Like `offset_of` functionality for Rust structs.
@@ -21,9 +21,17 @@
These versions will compile fine with rustc versions greater or equal to 1.19.
+Add the following lines at the top of your `main.rs` or `lib.rs` files.
+
+```rust,ignore
+#[macro_use]
+extern crate memoffset;
+```
+
## Examples ##
```rust
-use memoffset::{offset_of, span_of};
+#[macro_use]
+extern crate memoffset;
#[repr(C, packed)]
struct Foo {
@@ -61,5 +69,7 @@
Your crate root: (`lib.rs`/`main.rs`)
```rust,ignore
-#![feature(const_ptr_offset_from, const_refs_to_cell)]
+#![feature(ptr_offset_from, const_ptr_offset_from, const_maybe_uninit_as_ptr, const_raw_ptr_deref)]
```
+
+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 83479e2..71c00fc 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,126 +1,11 @@
// 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": "ZipFuseTest"
+ "name": "crossbeam-epoch_device_test_src_lib"
},
{
- "name": "apkdmverity.test"
- },
- {
- "name": "authfs_device_test_src_lib"
- },
- {
- "name": "diced_open_dice_cbor_test"
- },
- {
- "name": "diced_sample_inputs_test"
- },
- {
- "name": "diced_test"
- },
- {
- "name": "diced_utils_test"
- },
- {
- "name": "diced_vendor_test"
- },
- {
- "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": "virtualizationservice_device_test"
- }
- ],
- "presubmit-rust": [
- {
- "name": "ZipFuseTest"
- },
- {
- "name": "apkdmverity.test"
- },
- {
- "name": "authfs_device_test_src_lib"
- },
- {
- "name": "diced_open_dice_cbor_test"
- },
- {
- "name": "diced_sample_inputs_test"
- },
- {
- "name": "diced_test"
- },
- {
- "name": "diced_utils_test"
- },
- {
- "name": "diced_vendor_test"
- },
- {
- "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": "virtualizationservice_device_test"
+ "name": "memoffset_device_test_src_lib"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
index 5654962..0f253f0 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,17 +1,11 @@
{
"apex-available": [
"//apex_available:platform",
- "com.android.bluetooth",
- "com.android.compos",
"com.android.virt"
],
"dependencies": true,
- "dependency-blocklist": [
- "doc_comment"
- ],
"device": true,
- "min-sdk-version": "29",
+ "patch": "patches/Android.bp.patch",
"run": true,
- "tests": true,
- "vendor-available": true
-}
+ "tests": true
+}
\ No newline at end of file
diff --git a/ci/miri.sh b/ci/miri.sh
old mode 100755
new mode 100644
diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch
new file mode 100644
index 0000000..96c3e12
--- /dev/null
+++ b/patches/Android.bp.patch
@@ -0,0 +1,14 @@
+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",
+ ],
+ }
+
diff --git a/src/lib.rs b/src/lib.rs
index 1798d91..50d3e10 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -24,7 +24,8 @@
//!
//! ## Examples
//! ```
-//! use memoffset::{offset_of, span_of};
+//! #[macro_use]
+//! extern crate memoffset;
//!
//! #[repr(C, packed)]
//! struct HelpMeIAmTrappedInAStructFactory {
@@ -59,7 +60,13 @@
//#![no_std]
#![cfg_attr(
feature = "unstable_const",
- feature(const_ptr_offset_from, const_refs_to_cell)
+ feature(
+ ptr_offset_from,
+ const_fn,
+ const_ptr_offset_from,
+ const_maybe_uninit_as_ptr,
+ const_raw_ptr_deref,
+ )
)]
#[macro_use]
@@ -70,7 +77,7 @@
#[cfg(doctest)]
doctest!("../README.md");
-/// Hidden module for things the macros need to access.
+/// Hiden module for things the macros need to access.
#[doc(hidden)]
pub mod __priv {
#[doc(hidden)]
diff --git a/src/offset_of.rs b/src/offset_of.rs
index 8596e45..a363d30 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -72,7 +72,8 @@
///
/// ## Examples
/// ```
-/// use memoffset::offset_of;
+/// #[macro_use]
+/// extern crate memoffset;
///
/// #[repr(C, packed)]
/// struct Foo {
@@ -102,7 +103,8 @@
///
/// ## Examples
/// ```
-/// use memoffset::offset_of_tuple;
+/// #[macro_use]
+/// extern crate memoffset;
///
/// fn main() {
/// assert!(offset_of_tuple!((u8, u32), 1) >= 0, "Tuples do not have a defined layout");
@@ -253,18 +255,6 @@
#[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)]
diff --git a/src/span_of.rs b/src/span_of.rs
index a3663d5..5fa11ae 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -59,7 +59,8 @@
///
/// ## Examples
/// ```
-/// use memoffset::span_of;
+/// #[macro_use]
+/// extern crate memoffset;
///
/// #[repr(C)]
/// struct Florp {