Introduce ptr::hash for references#56250
Conversation
|
r? @aidanhs (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Code looks good imo; assigning over to someone on T-libs for review. r? @sfackler |
This comment has been minimized.
This comment has been minimized.
|
CC @alexcrichton this would've made that interning code in Cargo look more symmetric :) |
|
This seems like it's fine to me to add, but to align with |
|
My hesitation on a raw pointer was to avoid having to make a decision on whether a null pointer should be hashed or not. But I guess if |
|
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 |
Introduce ptr::hash for references The RHS is what I used, which wasn't as convenient as `ptr::eq`, so I wondered: should `ptr::hash` exist? My first Rust PR, so I'm going to need some guidance. :)
Introduce ptr::hash for references The RHS is what I used, which wasn't as convenient as `ptr::eq`, so I wondered: should `ptr::hash` exist? My first Rust PR, so I'm going to need some guidance. :)
| a == b | ||
| } | ||
|
|
||
| /// Hash the raw pointer address behind a reference, rather than the value |
There was a problem hiding this comment.
As now it's taking a pointer, "behind a reference" may need to be removed.
Introduce ptr::hash for references The RHS is what I used, which wasn't as convenient as `ptr::eq`, so I wondered: should `ptr::hash` exist? My first Rust PR, so I'm going to need some guidance. :)
|
💔 Test failed - status-travis |
|
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 retry rollup travis-ci/travis-ci#9696 |
Introduce ptr::hash for references The RHS is what I used, which wasn't as convenient as `ptr::eq`, so I wondered: should `ptr::hash` exist? My first Rust PR, so I'm going to need some guidance. :)
Rollup of 7 pull requests Successful merges: - #56000 (Add Armv8-M Mainline targets) - #56250 (Introduce ptr::hash for references) - #56434 (Improve query cycle errors for parallel queries) - #56516 (Replace usages of `..i + 1` ranges with `..=i`.) - #56555 (Send textual profile data to stderr, not stdout) - #56561 (Fix bug in from_key_hashed_nocheck) - #56574 (Fix a stutter in the docs for slice::exact_chunks) Failed merges: r? @ghost
@sinkuu you're right, well spotted. But I'm holding back on pushing a commit as I don't want to mess up any rollup efforts. I'm happy to push a fix either in this PR or a follow-up when it's best to. |
|
Followed up in #56602. |
Fix the just-introduced ptr::hash docs Follow-up to rust-lang#56250.
Allow ptr::hash to accept fat pointers Fat pointers implement Hash since rust-lang#45483. This is a follow-up to rust-lang#56250.
Allow ptr::hash to accept fat pointers Fat pointers implement Hash since rust-lang#45483. This is a follow-up to rust-lang#56250.
Allow ptr::hash to accept fat pointers Fat pointers implement Hash since rust-lang#45483. This is a follow-up to rust-lang#56250.
Allow ptr::hash to accept fat pointers Fat pointers implement Hash since rust-lang#45483. This is a follow-up to rust-lang#56250.
The RHS is what I used, which wasn't as convenient as
ptr::eq, so I wondered: shouldptr::hashexist?My first Rust PR, so I'm going to need some guidance. :)