Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upReplace HashMap implementation with SwissTable (as an external crate) #58623
Conversation
rust-highfive
assigned
nikomatsakis
Feb 21, 2019
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
label
Feb 21, 2019
This comment was marked as outdated.
This comment was marked as outdated.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
alexcrichton
and unassigned
nikomatsakis
Feb 21, 2019
Amanieu
referenced this pull request
Feb 21, 2019
Closed
Replace HashMap implementation with SwissTable #56241
This comment was marked as outdated.
This comment was marked as outdated.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This comment has been minimized.
This comment has been minimized.
|
Is this blocked on the review of #56241 ? |
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
23d4b1f
to
98ef879
Feb 22, 2019
This comment was marked as outdated.
This comment was marked as outdated.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This comment was marked as outdated.
This comment was marked as outdated.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
b42286f
to
e08307b
Feb 22, 2019
This comment was marked as outdated.
This comment was marked as outdated.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
e08307b
to
4ba6550
Feb 22, 2019
This comment was marked as outdated.
This comment was marked as outdated.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This comment has been minimized.
This comment has been minimized.
|
Can we do a crater run to see if there are any regressions? |
This comment has been minimized.
This comment has been minimized.
Sort-of. I've been including most of the feedback from that thread into hashbrown itself. |
This comment was marked as resolved.
This comment was marked as resolved.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors: try While review progresses let's in parallel start some programmatic analysis! (aka perf runs, crater runs, etc) |
This comment was marked as resolved.
This comment was marked as resolved.
|
This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
2b917d0
to
76003ba
Feb 25, 2019
Amanieu
referenced this pull request
Feb 25, 2019
Merged
Prepare hashbrown for inclusion in the standard library #46
This comment has been minimized.
This comment has been minimized.
|
This issue should probably be addressed before merging: Amanieu/hashbrown#47 |
This comment has been minimized.
This comment has been minimized.
|
@bors: try |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Feb 25, 2019
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@rust-timer build abade53 |
This comment has been minimized.
This comment has been minimized.
|
The test failures for FlixCoder.EvoResNN and clinuxrulz.sodium-rust-push-pull don't reproduce locally, so I'm just going to mark them as spurious. cargo-lichking seems to be a real regression though, and I might need a bit of help figuring it out. There is a compile error on this line:
This error does not happen on master. Adding Any ideas? |
This comment has been minimized.
This comment has been minimized.
|
I think this may be related to unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
...
}While hashbrown has this instead: unsafe impl<#[may_dangle] T> Drop for RawTable<T> {
...
}( |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
It sounds like a bug in may_dangle. cc @nikomatsakis @pnkfelix -- there shouldn't be any difference with |
This comment has been minimized.
This comment has been minimized.
Amanieu/hashbrown#51 cc @RalfJung Once hashbrown is moved into the rust-lang org I can work on setting up better CI for it. |
This comment has been minimized.
This comment has been minimized.
@gnzlbg already took care of that, awesome. :) |
This comment has been minimized.
This comment has been minimized.
|
OK, I've had a look at the drop check issue. There are two problems:
I've checked all of the remaining structs, and everything else looks good. Full reviewLive means that all lifetimes in this type argument must be live
|
| Type | Live | Owned | Unused |
|---|---|---|---|
HashMap<K, V, S> |
K, V, S |
||
Drain<'a, K, V> |
'a, K, V |
||
Entry<'a, K, V> |
K |
'a, V |
|
IntoIter<K, V> |
K, V |
||
Iter<'a, K, V> |
'a, K, V |
||
IterMut<'a, K, V> |
'a, K, V |
||
Keys<'a, K, V> |
'a, K, V |
||
OccupiedEntry<'a, K, V> |
K |
'a, V |
|
VacantEntry<'a, K, V> |
K |
'a, V |
|
Values<'a, K, V> |
'a, K, V |
||
ValuesMut<'a, K, V> |
'a, K, V |
hashbrown
| Type | Live | Owned | Unused |
|---|---|---|---|
HashMap<K, V, S> |
S |
K, V |
|
Drain<'a, K, V> |
'a, K, V |
||
Entry<'a, K, V> |
K |
'a, V |
|
IntoIter<K, V> |
K, V |
||
Iter<'a, K, V> |
'a, K, V |
||
IterMut<'a, K, V> |
'a, K, V |
||
Keys<'a, K, V> |
'a, K, V |
||
OccupiedEntry<'a, K, V> |
K |
'a, V |
|
VacantEntry<'a, K, V> |
K |
'a, V |
|
Values<'a, K, V> |
'a, K, V |
||
ValuesMut<'a, K, V> |
'a, K, V |
hash_set
Current
| Type | Live | Owned | Unused |
|---|---|---|---|
HashSet<T, S> |
S, T |
||
Difference<'a, T, S> |
'a, T, S |
||
Drain<'a, K> |
'a, K |
||
Intersection<'a, T, S> |
'a, T, S |
||
IntoIter<K> |
K |
||
Iter<'a, K> |
'a, K |
||
SymmetricDifference<'a, T, S> |
'a, T, S |
||
Union<'a, T, S> |
'a, T, S |
hashbrown
| Type | Live | Owned | Unused |
|---|---|---|---|
HashSet<T, S> |
S |
T |
|
Difference<'a, T, S> |
'a, T, S |
||
Drain<'a, K> |
'a, K |
||
Intersection<'a, T, S> |
'a, T, S |
||
IntoIter<K> |
K |
||
Iter<'a, K> |
'a, K |
||
SymmetricDifference<'a, T, S> |
'a, T, S |
||
Union<'a, T, S> |
'a, T, S |
Example tests (independant of NLL)
Test case for 1.
fn check_hash_set() {
fn equate<T>(
_: &mut Option<std::collections::hash_set::IntoIter<T>>,
_: &mut T
) {}
let (mut x, a, mut k);
x = None;
a = 0;
k = &a;
equate(&mut x, &mut k);
}
fn check_hash_map() {
fn equate<K, V>(
_: &mut Option<std::collections::hash_map::IntoIter<K, V>>,
_: &mut (K, V)
) {}
let (mut x, a, mut k);
x = None;
a = 0;
k = (&a, &a);
equate(&mut x, &mut k);
}Test case for 2. (I'm not sure if we add ui tests for the standard library)
struct D<'a>(&'a i32);
impl Drop for D<'_> {
fn drop(&mut self) {}
}
fn check_hash_set() {
fn equate<T>(
_: &mut Option<std::collections::HashSet<T>>, // and likewise for hash_map::IntoIter
_: &mut T
) {}
let (mut x, a);
let mut k;
x = None;
a = 0;
k = D(&a); //~ ERROR
equate(&mut x, &mut k);
}
fn check_hash_map() {
fn equate<K, V>(
_: &mut Option<std::collections::HashMap<K, V>>, // and likewise for hash_map::IntoIter
_: &mut (K, V)
) {}
let (mut x, a, b);
let mut k;
x = None;
a = 0;
b = 0;
k = (
D(&a), //~ ERROR
D(&b), //~ ERROR
);
equate(&mut x, &mut k);
}
This comment was marked as resolved.
This comment was marked as resolved.
|
|
This comment has been minimized.
This comment has been minimized.
|
@matthewjasper Thanks! I've done the changes you suggested and the regression on cargo-lichking is now fixed! |
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
0aac051
to
a238a95
Mar 9, 2019
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@Amanieu you have some rebasing to do; @alexcrichton you have some reviewing to do? |
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
a238a95
to
1d30c64
Mar 30, 2019
This comment has been minimized.
This comment has been minimized.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
bors bot
added a commit
to Amanieu/hashbrown
that referenced
this pull request
Mar 30, 2019
bors bot
added a commit
to Amanieu/hashbrown
that referenced
this pull request
Mar 30, 2019
This comment has been minimized.
This comment has been minimized.
|
|
Amanieu
added some commits
Feb 7, 2019
Amanieu
force-pushed the
Amanieu:hashbrown3
branch
from
1d30c64
to
f69c116
Apr 2, 2019
This comment has been minimized.
This comment has been minimized.
|
I just published hashbrown 0.2.0 which includes the changes necessary for inclusion in libstd. This PR is ready for merging. |
This comment has been minimized.
This comment has been minimized.
|
Nice! Since we're so close to a release (next Thursday), @Amanieu would you be ok delaying this for a week to ensure we maximize the amount of testing time? |
Amanieu commentedFeb 21, 2019
This is the same as #56241 except that it imports
hashbrownas an external crate instead of copying the implementation into libstd.This includes a few API changes (all unstable):
try_reserveis added toHashSet.raw_entryAPI.search_buckethas been removed from theraw_entryAPI (doesn't work with SwissTable).