Commit Graph

720 Commits

Author SHA1 Message Date
openharmony_ci bc1710c99b !3 告警与遗留问题文件补充
Merge pull request !3 from peizhe/master
OpenHarmony-v4.0-Beta1 OpenHarmony-v4.0-Beta2
2023-05-09 11:13:45 +00:00
peizhe c46b285f92 告警与遗留问题文件补充
Signed-off-by: peizhe <zhaipeizhe@huawei.com>
2023-05-08 15:40:15 +08:00
openharmony_ci 71f60cd43a !2 CI OAT 告警清零与README.OpenSource 中License信息整改
Merge pull request !2 from peizhe/master
2023-05-04 06:58:54 +00:00
peizhe 3558bf74e0 CI OAT 告警清零与README.OpenSource 中License信息整改
Signed-off-by: peizhe <zhaipeizhe@huawei.com>
2023-05-04 09:17:21 +08:00
openharmony_ci 06f0d6b4bf !1 [hashbrown]Add GN Build Files and Custom Modifications to Rust Third-party Libraries
Merge pull request !1 from peizhe/master
2023-04-19 01:28:38 +00:00
peizhe b4c9d6b45c Add GN Build Files and Custom Modifications
Signed-off-by: peizhe <472708703@qq.com>
2023-04-18 18:19:23 +08:00
Amanieu d'Antras ee35a8b4a6 Version 0.12.3 github.com/rust-lang/hashbrown/refs/tags/v0.12.3 2022-07-17 13:18:37 +02:00
bors 2bd241908c Auto merge of #348 - Amanieu:clone_from_panic_in_drop, r=Amanieu
Fix double-drop in RawTable::clone_from

If an element from the destination table panics from its `Drop` impl
then elements from that table would end up being dropped twice, which is
unsound.
2022-07-17 11:00:50 +00:00
Amanieu d'Antras 0dfd4406af Fix double-drop in RawTable::clone_from
If an element from the destination table panics from its `Drop` impl
then elements from that table would end up being dropped twice, which is
unsound.
2022-07-17 01:13:44 +02:00
bors fd779d77a7 Auto merge of #347 - Amanieu:fix_ci_cross, r=Amanieu
Bump version tested on CI to 1.58.1

This is needed because cross-rs increased its MSRV to 1.58.1.

One CI builder is kept at 1.56.1 without using cross-rs to guarantee
that compatibility is maintained.
2022-07-16 23:02:15 +00:00
Amanieu d'Antras cf06e740f1 Bump version tested on CI to 1.58.1
This is needed because cross-rs increased its MSRV to 1.58.1.

One CI builder is kept at 1.56.1 without using cross-rs to guarantee
that compatibility is maintained.
2022-07-17 01:01:05 +02:00
Amanieu d'Antras 3f0faa1710 Merge pull request #346 from rust-lang/cuviper-patch-1
Fix a misplaced bullet in CHANGELOG.md
2022-07-13 13:25:51 +02:00
Josh Stone e6fd7076b7 Fix a misplaced bullet in CHANGELOG.md 2022-07-12 17:04:30 -07:00
Amanieu d'Antras 2b468c9420 Version 0.12.2 2022-07-09 00:59:00 +01:00
bors df9c0074d2 Auto merge of #342 - cuviper:set-entry, r=Amanieu
Add an Entry API for HashSet

This adds `HashSet::entry` and `rustc_entry`, mimicking the API of `HashMap`. The "rustc" variants are without the `S` type parameter, just like the difference on maps. Set entries have fewer methods since there's no mutable value like in maps, but the basic insert/remove/replace functionality is there.

Resolves #274.
2022-06-18 00:52:20 +00:00
Josh Stone 801f752a28 Add an Entry API for HashSet 2022-06-17 16:17:26 -07:00
bors d77eb0445e Auto merge of #343 - dtolnay-contrib:rustversion, r=Amanieu
Allow compiling on 1.56.0

Rust 1.56.1 is only adding a compile warning for certain hidden unicode codepoints in source code, which sounds totally unrelated to hashbrown. See https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html and https://github.com/rust-lang/rust/compare/1.56.0...1.56.1. I don't see the point of forbidding users from compiling hashbrown using 1.56.0.
2022-06-17 05:49:24 +00:00
David Tolnay a538f521d6 Allow compiling on 1.56.0 2022-06-16 19:48:42 -07:00
bors 9e2b8cac02 Auto merge of #339 - JustForFun88:update_hashbrown_doc_3, r=Amanieu
Improving documentation. Part 3.

Continuation of #328 and #331.

Also I made some changes in the previously added examples (made `compute_hash` generic and rename `compute_hash` to `make_hasher` in `insert_with_hasher example`)
2022-06-10 00:26:33 +00:00
bors 2d64aad667 Auto merge of #340 - JustForFun88:add_new_extend, r=Amanieu
Adding `Extend<&'a (K, V)> for HashMap<K, V, S, A>`

I think that it is strange that we can do something like this:
```rust
fn main() {
    use hashbrown::HashMap;
    let mut map = HashMap::new();
    let some_vec: Vec<_> = vec![(1, 1), (2, 2), (3, 3), (4, 4)];
    map.extend(some_vec.iter().map(|&(k, v)| (k, v)));
}
```
but cannot do something like this:
```rust
fn main() {
    use hashbrown::HashMap;
    let mut map = HashMap::new();
    let some_vec: Vec<_> = vec![(1, 1), (2, 2), (3, 3), (4, 4)];
    map.extend(some_vec.iter()); // Or map.extend(&some_vec);
}
```
In any case, it can work only if K and V are Copy, and also inside `Extend<(K, V)>` we use `HashMap::insert`, not `HashMap::insert_unique_unchecked`, so adding `Extend<&'a (K, V)>` should be Ok.
2022-06-09 09:03:02 +00:00
bors 552c312b80 Auto merge of #341 - JustForFun88:edit_do_alloc, r=Amanieu
Editing `do_alloc` for reducing LLVM IR

1. I think this will speed up compilation, since one way or another everything will come down to this code (but I didn’t compare performance).

2. I don’t know if the compiler was able to optimize that old code, but it literally checked the same thing twice (due to `map` and `map_err` in a row, and roughly speaking it came down to:
    ```rust
    pub fn do_alloc<A: Allocator>(alloc: &A, layout: Layout) -> Result<NonNull<u8>, ()> {
        match match alloc.allocate(layout) {
            Ok(ptr) => Ok(ptr.as_non_null_ptr()),
            Err(e) => Err(e),
        } {
            Ok(ptr) => Ok(ptr),
            Err(_) => Err(()),
        }
    }
    ```
    And when the code is written explicitly, it is immediately clear that it looks strange. And why force the compiler to think beyond the need?

3. And finally, in my opinion, the readability of the code has not only not decreased, but even increased.
2022-06-09 08:50:19 +00:00
JustForFun88 29e093b7a1 Editing do_alloc for reducing LLVM IR 2022-06-05 23:32:01 +05:00
JustForFun88 f59786a53f Run fmt 2022-06-05 01:04:56 +05:00
JustForFun88 61b4e90e65 Adding Extend<&'a (K, V)> for HashMap<K, V, S, A> 2022-06-05 00:44:26 +05:00
JustForFun88 24fc7ade1f Correcting mistakes 2022-06-04 20:06:20 +05:00
JustForFun88 b1dca62cfe Improved documentation of Entry, EntryRef 2022-06-04 17:22:42 +05:00
bors 97369539f3 Auto merge of #338 - AngelicosPhosphoros:master, r=Amanieu
Add shortcircuit in iteration if we yielded all elements

Current implementation works little slower than `set.iter().take(set.len())`.
See my comment [here](https://github.com/rust-lang/rust/pull/97215#issuecomment-1132871046).

So why not avoid extra integer which added by `Iterator::take` if we can add limiting logic into our iterator itself?

I don't really know how this change affects [reflect_toogle_full](https://github.com/rust-lang/hashbrown/blob/efbeb7e7d03eae8a2656988af4f8d928340acc08/src/raw/mod.rs#L2019) and implementation of [FusedIterator](https://github.com/rust-lang/hashbrown/blob/efbeb7e7d03eae8a2656988af4f8d928340acc08/src/raw/mod.rs#L2150). Maybe I should make inner iterator "jump" to the end of its memory block?
2022-06-03 16:02:24 +00:00
JustForFun88 c7e17632f6 Make compute_hash more general 2022-06-02 23:37:55 +05:00
JustForFun88 bdbf988630 Further improvement of doc 2022-06-02 08:26:00 +05:00
AngelicosPhosphoros 3e8f6c4837 Add shortcircuit in iteration if we yielded all elements
Current implementation works little slower than `set.iter().take(set.len())`.
See my comment [here](https://github.com/rust-lang/rust/pull/97215#issuecomment-1132871046).

So why not avoid extra integer which added by `Iterator::take` if we can add limiting logic into our iterator itself?

Also, removed end pointer check if we can limit iteration by counting items yielded.
2022-06-01 15:01:10 +03:00
JustForFun88 06e1d6190e Add doc for EntryRef and OccupiedEntry 2022-06-01 07:29:41 +05:00
JustForFun88 83571ff422 Add doc for Entry struct and extend functions 2022-05-31 00:15:47 +05:00
bors d01a699354 Auto merge of #331 - JustForFun88:update_hashbrown_doc_2, r=Amanieu
Improving documentation. Part 2.

Continuation of #328.
Close #337.
2022-05-23 09:53:41 +00:00
JustForFun88 7122d758f0 Finishing doc improving fore now 2022-05-18 23:38:35 +05:00
JustForFun88 c1be84627e One more update 2022-05-18 07:18:45 +05:00
JustForFun88 dafdb0b529 One more update 2022-05-18 07:15:10 +05:00
bors efbeb7e7d0 Auto merge of #335 - JustForFun88:pub_map_inner, r=Amanieu
Adding function for getting access to map `table: RawTable<(K, V), A>` field

I was a little interested in issues "API for removing by key hash and value" #330. The original question was about adding a fancy API, and of course it wasn't merged (#334).

However, it seems to me that this shows that it would be nice to just add the ability to access to map's fields. And let the user himself do what he pleases.

The user will still not be able to change the existing API. But at the same time, he will have the opportunity to add small extensions. Otherwise, when using `RawTable`, he will have to not only add one or two functions, but generally recreate all the `HashMap`’s APIs, which can be difficult.
2022-05-17 20:55:15 +00:00
JustForFun88 2bee4aa83d Making example more ergonomic 2022-05-17 10:02:21 +05:00
JustForFun88 3e7e30099c Using function instead of feature 2022-05-17 07:24:35 +05:00
JustForFun88 7174fce9f2 Merge remote-tracking branch 'origin/update_hashbrown_doc_2' into update_hashbrown_doc_2 2022-05-16 18:35:07 +05:00
JustForFun88 90adfa1e87 Further doc improvement 2022-05-16 18:34:38 +05:00
JustForFun88 48c2e0854d Merge branch 'rust-lang:master' into update_hashbrown_doc_2 2022-05-16 12:24:29 +05:00
JustForFun88 f6a1957823 Merge branch 'rust-lang:master' into pub_map_inner 2022-05-16 12:24:07 +05:00
bors 4ab9319872 Auto merge of #336 - JustForFun88:unused_macros, r=Amanieu
Allow unused macro rules for macro `cfg_if`.

The unused macro rules lint is an new lint for the rust compiler: [rust-lang/rust#96150](https://github.com/rust-lang/rust/pull/96150)
2022-05-16 06:39:52 +00:00
JustForFun88 6efc34c0ac Update macros.rs 2022-05-15 21:37:07 +05:00
JustForFun88 182d57ea81 Allow unused macro rules for macro cfg_if.
The unused macro rules lint is an upcoming lint for the rust compiler: [rust-lang/rust#96150](https://github.com/rust-lang/rust/pull/96150)
2022-05-15 16:37:40 +05:00
JustForFun88 88c483ce12 Adding map-inner feature for getting access to map fields 2022-05-15 15:05:22 +05:00
JustForFun88 00b1d61bdc Running fmt 2022-05-13 22:39:09 +05:00
JustForFun88 486abf9190 Adding some example and more.
Adding some example and correcting inconsistent "example" and "examples" in headers
2022-05-13 22:36:18 +05:00
JustForFun88 439955d30c Merge branch 'rust-lang:master' into update_hashbrown_doc_2 2022-05-13 08:02:07 +05:00