aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2021-03-03 20:53:05 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-03-03 20:53:05 +0000
commit01d8caf1844e58ec5fd9b936b63448d0f8eb751c (patch)
treeab89590740a142c65a67b288c5848e7fdc22fe28
parente44e7ca94b8d174d8a5625b74dd8888ad532e60b (diff)
parentf94bcf722d168939e2c6f83a880e3ff40c55bcf7 (diff)
downloadlinked-hash-map-01d8caf1844e58ec5fd9b936b63448d0f8eb751c.tar.gz
Upgrade rust/crates/linked-hash-map to 0.5.4 am: e6637b13d6 am: 997d136d0f am: 3309989f41 am: f94bcf722d
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/linked-hash-map/+/1581960 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I004ba8e760efd4de9db469e593f50098f2762bef
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp51
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig4
-rw-r--r--METADATA10
-rw-r--r--README.md2
-rw-r--r--TEST_MAPPING10
-rw-r--r--src/lib.rs13
8 files changed, 38 insertions, 58 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index f9cc1a3..020e8b8 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "f1ee0d032368e4912af9d4620bd0ec3857838f2e"
+ "sha1": "0531e100ef052fd49b2f465abf96cd88aea84692"
}
}
diff --git a/Android.bp b/Android.bp
index 38dc917..cb2c07b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,42 +1,5 @@
// This file is generated by cargo2android.py --device --run --dependencies --test.
-
-package {
- default_applicable_licenses: [
- "external_rust_crates_linked-hash-map_license",
- ],
-}
-
-// Added automatically by a large-scale-change that took the approach of
-// 'apply every license found to every target'. While this makes sure we respect
-// every license restriction, it may not be entirely correct.
-//
-// e.g. GPL in an MIT project might only apply to the contrib/ directory.
-//
-// Please consider splitting the single license below into multiple licenses,
-// taking care not to lose any license_kind information, and overriding the
-// default license using the 'licenses: [...]' property on targets as needed.
-//
-// For unused files, consider creating a 'filegroup' with "//visibility:private"
-// to attach the license to, and including a comment whether the files may be
-// used in the current project.
-//
-// large-scale-change included anything that looked like it might be a license
-// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
-//
-// Please consider removing redundant or irrelevant files from 'license_text:'.
-// http://go/android-license-faq
-license {
- name: "external_rust_crates_linked-hash-map_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- "SPDX-license-identifier-MIT",
- ],
- license_text: [
- "LICENSE-APACHE",
- "LICENSE-MIT",
- ],
-}
+// Do not modify this file as changes will be overridden on upgrade.
rust_library {
name: "liblinked_hash_map",
@@ -58,6 +21,9 @@ rust_defaults {
rust_test_host {
name: "linked-hash-map_host_test_src_lib",
defaults: ["linked-hash-map_defaults"],
+ test_options: {
+ unit_test: true,
+ },
}
rust_test {
@@ -80,6 +46,9 @@ rust_test_host {
name: "linked-hash-map_host_test_tests_heapsize",
defaults: ["linked-hash-map_defaults_linked_hash_map"],
srcs: ["tests/heapsize.rs"],
+ test_options: {
+ unit_test: true,
+ },
}
rust_test {
@@ -92,6 +61,9 @@ rust_test_host {
name: "linked-hash-map_host_test_tests_serde",
defaults: ["linked-hash-map_defaults_linked_hash_map"],
srcs: ["tests/serde.rs"],
+ test_options: {
+ unit_test: true,
+ },
}
rust_test {
@@ -104,6 +76,9 @@ rust_test_host {
name: "linked-hash-map_host_test_tests_test",
defaults: ["linked-hash-map_defaults_linked_hash_map"],
srcs: ["tests/test.rs"],
+ test_options: {
+ unit_test: true,
+ },
}
rust_test {
diff --git a/Cargo.toml b/Cargo.toml
index e3f6a18..b2d5572 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,12 +12,12 @@
[package]
name = "linked-hash-map"
-version = "0.5.3"
+version = "0.5.4"
authors = ["Stepan Koltsov <stepan.koltsov@gmail.com>", "Andrew Paseltiner <apaseltiner@gmail.com>"]
exclude = ["/.travis.yml", "/deploy-docs.sh"]
description = "A HashMap wrapper that holds key-value pairs in insertion order"
homepage = "https://github.com/contain-rs/linked-hash-map"
-documentation = "https://contain-rs.github.io/linked-hash-map/linked_hash_map"
+documentation = "https://docs.rs/linked-hash-map"
readme = "README.md"
keywords = ["data-structures"]
license = "MIT/Apache-2.0"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 87d7927..cb43704 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,7 +1,7 @@
[package]
name = "linked-hash-map"
-version = "0.5.3"
+version = "0.5.4"
license = "MIT/Apache-2.0"
description = "A HashMap wrapper that holds key-value pairs in insertion order"
authors = [
@@ -11,7 +11,7 @@ authors = [
repository = "https://github.com/contain-rs/linked-hash-map"
homepage = "https://github.com/contain-rs/linked-hash-map"
-documentation = "https://contain-rs.github.io/linked-hash-map/linked_hash_map"
+documentation = "https://docs.rs/linked-hash-map"
keywords = ["data-structures"]
readme = "README.md"
exclude = ["/.travis.yml", "/deploy-docs.sh"]
diff --git a/METADATA b/METADATA
index 343ee7e..e3889bb 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/linked-hash-map/linked-hash-map-0.5.3.crate"
+ value: "https://static.crates.io/crates/linked-hash-map/linked-hash-map-0.5.4.crate"
}
- version: "0.5.3"
+ version: "0.5.4"
license_type: NOTICE
last_upgrade_date {
- year: 2020
- month: 6
- day: 11
+ year: 2021
+ month: 2
+ day: 9
}
}
diff --git a/README.md b/README.md
index fb701eb..f93b6fc 100644
--- a/README.md
+++ b/README.md
@@ -12,4 +12,4 @@ We are currently only accepting changes which:
A HashMap wrapper that holds key-value pairs in insertion order.
-Documentation is available at https://contain-rs.github.io/linked-hash-map/linked_hash_map.
+Documentation is available at https://docs.rs/linked-hash-map.
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 23e98ee..d694cb4 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,20 +1,20 @@
-// Generated by cargo2android.py for tests in Android.bp
+// Generated by update_crate_tests.py for tests that depend on this crate.
{
"presubmit": [
{
"name": "linked-hash-map_device_test_src_lib"
},
{
- "name": "linked-hash-map_device_test_tests_heapsize"
+ "name": "lru-cache_device_test_src_lib"
},
{
- "name": "linked-hash-map_device_test_tests_serde"
+ "name": "linked-hash-map_device_test_tests_test"
},
{
- "name": "linked-hash-map_device_test_tests_test"
+ "name": "linked-hash-map_device_test_tests_serde"
},
{
- "name": "lru-cache_device_test_src_lib"
+ "name": "linked-hash-map_device_test_tests_heapsize"
}
]
}
diff --git a/src/lib.rs b/src/lib.rs
index 5abdea2..2754217 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -86,6 +86,7 @@ impl<K: Eq> Eq for KeyRef<K> {}
// due to conflicting implementations of `Borrow`. The layout of `&Qey<Q>` must be identical to
// `&Q` in order to support transmuting in the `Qey::from_ref` method.
#[derive(Hash, PartialEq, Eq)]
+#[repr(transparent)]
struct Qey<Q: ?Sized>(Q);
impl<Q: ?Sized> Qey<Q> {
@@ -109,11 +110,15 @@ impl<K, V> Node<K, V> {
}
}
+// drop empty node without dropping its key and value
unsafe fn drop_empty_node<K, V>(the_box: *mut Node<K, V>) {
- // Prevent compiler from trying to drop the un-initialized key and values in the node.
- let Node { key, value, .. } = *Box::from_raw(the_box);
- mem::forget(key);
- mem::forget(value);
+ // Safety:
+ // In this crate all `Node` is allocated via `Box` or `alloc`, and `Box` uses the
+ // Global allocator for its allocation,
+ // (https://doc.rust-lang.org/std/boxed/index.html#memory-layout) so we can safely
+ // deallocate the pointer to `Node` by calling `dealloc` method
+ let layout = std::alloc::Layout::new::<Node<K, V>>();
+ std::alloc::dealloc(the_box as *mut u8, layout);
}
impl<K: Hash + Eq, V> LinkedHashMap<K, V> {