New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ptr::hash for references #56250

Merged
merged 11 commits into from Dec 7, 2018

Conversation

Projects
None yet
9 participants
@dwijnand
Copy link
Member

dwijnand commented Nov 26, 2018

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. :)

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Nov 26, 2018

r? @aidanhs

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Nov 26, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1de059fc:start=1543257564730527081,finish=1543257565667551557,duration=937024476
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---

[00:03:35] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:36] tidy error: /checkout/src/libcore/ptr.rs:2529: TODO is deprecated; use FIXME
[00:03:37] some tidy checks failed
[00:03:37] 
[00:03:37] 
[00:03:37] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:37] 
[00:03:37] 
[00:03:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:37] Build completed unsuccessfully in 0:01:02
[00:03:37] Build completed unsuccessfully in 0:01:02
[00:03:37] Makefile:79: recipe for target 'tidy' failed
[00:03:37] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1225f6aa
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Nov 26 18:43:12 UTC 2018
---
travis_time:end:1c509d74:start=1543257792903884151,finish=1543257792908253959,duration=4369808
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0999ce96
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1275aed8
travis_time:start:1275aed8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:06ee9a6e
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Nov 26, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:123b48b4:start=1543260307759269032,finish=1543260308857374879,duration=1098105847
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:49:07] .................................................................................................... 100/5067
[00:49:09] .................................................................................................... 200/5067
[00:49:12] .............................ii............................................ii...................ii.. 300/5067
[00:49:15] ..............................................................................................iii... 400/5067
[00:49:18] .....iiiiiiii.iii............................iii...........................................i........ 500/5067
[00:49:24] .................................................................................................... 700/5067
[00:49:30] ................................................................................................i... 800/5067
[00:49:33] ........i........................................................................................... 900/5067
[00:49:37] ...............iiiii...................iiiiii....................................................... 1000/5067
[00:49:37] ...............iiiii...................iiiiii....................................................... 1000/5067
[00:49:39] ..........................................................................................iiiiiiii.. 1100/5067
[00:49:43] .................................................................................................... 1300/5067
[00:49:46] .................................................................................................... 1400/5067
[00:49:48] .............................................i...................................................... 1500/5067
[00:49:51] ..............i.........ii..........................................................i............... 1600/5067
---
[00:50:15] .................................................................................................... 2300/5067
[00:50:19] .................................................................................................... 2400/5067
[00:50:23] .................................................................................................... 2500/5067
[00:50:26] .................................................................................................... 2600/5067
[00:50:30] ...iiiiiiiii........................................................................................ 2700/5067
[00:50:35] .................................................................................................... 2900/5067
[00:50:39] .................................................................................................... 3000/5067
[00:50:42] ..................................................................i................................. 3100/5067
[00:50:45] .................................................................................................... 3200/5067
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:04:25] 
[01:04:25] running 117 tests
[01:04:28] i..ii...iii..iiii.....i...i.........i..iii...........i.....i.....ii...i..i.ii..............i...ii..i 100/117
[01:04:28] i.i.....iiii.....
[01:04:28] 
[01:04:28]  finished in 3.337
[01:04:28] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:04:42] 
[01:04:42] running 118 tests
[01:05:06] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[01:05:09] ......iii.i.....ii
[01:05:09] 
[01:05:09]  finished in 27.363
[01:05:09] travis_fold:end:test_debuginfo

---
[01:20:56] .................................................................................................... 1500/2174
[01:21:07] .................................................................................................... 1600/2174
[01:21:19] .................................................................................................... 1700/2174
[01:21:31] .................................................................................................... 1800/2174
[01:21:43] ..............................................................................................F..... 1900/2174
[01:22:12] ..........................................................................................i......... 2100/2174
[01:22:22] .............................................i............................
[01:22:22] failures:
[01:22:22] 
[01:22:22] 
[01:22:22] ---- ptr.rs - ptr::hash (line 2517) stdout ----
[01:22:22] error[E0308]: mismatched types
[01:22:22]   --> ptr.rs:2526:21
[01:22:22]    |
[01:22:22] 12 | ptr::hash(five_ref, hasher);
[01:22:22]    |                     |
[01:22:22]    |                     |
[01:22:22]    |                     expected &mut _, found struct `std::collections::hash_map::DefaultHasher`
[01:22:22]    |                     help: consider mutably borrowing here: `&mut hasher`
[01:22:22]    = note: expected type `&mut _`
[01:22:22]               found type `std::collections::hash_map::DefaultHasher`
[01:22:22] 
[01:22:22] 
[01:22:22] thread 'ptr.rs - ptr::hash (line 2517)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:323:13
[01:22:22] 
[01:22:22] 
[01:22:22] failures:
[01:22:22]     ptr.rs - ptr::hash (line 2517)
[01:22:22]     ptr.rs - ptr::hash (line 2517)
[01:22:22] 
[01:22:22] test result: FAILED. 2170 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out
[01:22:22] 
[01:22:22] error: test failed, to rerun pass '--doc'
[01:22:22] 
[01:22:22] 
[01:22:22] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "core" "--" "--quiet"
[01:22:22] 
[01:22:22] 
[01:22:22] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:22:22] Build completed unsuccessfully in 0:37:05
[01:22:22] Build completed unsuccessfully in 0:37:05
[01:22:22] Makefile:58: recipe for target 'check' failed
[01:22:22] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1bc6e200
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Nov 26 20:47:40 UTC 2018
---
35572 ./.git/modules/src/libcompiler_builtins/modules/compiltravis_time:end:083b7d2a:start=1543265264175210174,finish=1543265264303486793,duration=128276619
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0dabea68
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:05056d88
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

Show resolved Hide resolved src/libcore/ptr.rs Outdated
Show resolved Hide resolved src/libcore/ptr.rs Outdated
Show resolved Hide resolved src/libcore/ptr.rs Outdated

dwijnand added some commits Nov 27, 2018

@dwijnand dwijnand changed the title [WIP] Introduce ptr::hash for references Introduce ptr::hash for references Nov 27, 2018

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Nov 27, 2018

Code looks good imo; assigning over to someone on T-libs for review.

r? @sfackler

@rust-highfive rust-highfive assigned sfackler and unassigned aidanhs Nov 27, 2018

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Nov 27, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:04f93c38:start=1543337918613894471,finish=1543338004440039400,duration=85826144929
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:50:11] .................................................................................................... 100/5064
[00:50:14] .................................................................................................... 200/5064
[00:50:17] .............................ii............................................ii...................ii.. 300/5064
[00:50:19] ..............................................................................................iii... 400/5064
[00:50:22] .....iiiiiiii.iii............................iii...........................................i........ 500/5064
[00:50:29] .................................................................................................... 700/5064
[00:50:34] ................................................................................................i... 800/5064
[00:50:38] ........i........................................................................................... 900/5064
[00:50:41] ...............iiiii..................ii.iiii....................................................... 1000/5064
---
[00:51:20] .................................................................................................... 2300/5064
[00:51:24] .................................................................................................... 2400/5064
[00:51:28] .................................................................................................... 2500/5064
[00:51:31] .................................................................................................... 2600/5064
[00:51:35] .......iiiiiiiii.................................................................................... 2700/5064
[00:51:41] .................................................................................................... 2900/5064
[00:51:44] .................................................................................................... 3000/5064
[00:51:47] ......................................................................i............................. 3100/5064
[00:51:50] .................................................................................................... 3200/5064
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:39] 
[01:05:39] running 117 tests
[01:05:42] i..ii...iii..iiii.....i...i.........i..iii...........i.....i.....ii...i..i.ii..............i...ii..i 100/117
[01:05:43] i.i.....iiii.....
[01:05:43] 
[01:05:43]  finished in 3.372
[01:05:43] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:57] 
[01:05:57] running 118 tests
[01:06:20] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[01:06:24] ......iii.i.....ii
[01:06:24] 
[01:06:24]  finished in 27.087
[01:06:24] travis_fold:end:test_debuginfo

---
[01:22:21] .................................................................................................... 1500/2174
[01:22:32] .................................................................................................... 1600/2174
[01:22:44] .................................................................................................... 1700/2174
[01:22:57] .................................................................................................... 1800/2174
[01:23:09] ..............................................................................................F..... 1900/2174
[01:23:39] ..........................................................................................i......... 2100/2174
[01:23:48] .............................................i............................
[01:23:48] failures:
[01:23:48] 
[01:23:48] 
[01:23:48] ---- ptr.rs - ptr::hash (line 2514) stdout ----
[01:23:48] error[E0412]: cannot find type `T` in this scope
[01:23:48]   --> ptr.rs:2527:21
[01:23:48]    |
[01:23:48] 16 | (five_ref as *const T).hash(&mut hasher);
[01:23:48]    |                     ^ not found in this scope
[01:23:48] 
[01:23:48] error[E0658]: use of unstable library feature 'ptr_hash': newly added (see issue #56286)
[01:23:48]   --> ptr.rs:2523:1
[01:23:48]    |
[01:23:48] 12 | ptr::hash(five_ref, &mut hasher);
[01:23:48]    |
[01:23:48]    = help: add #![feature(ptr_hash)] to the crate attributes to enable
[01:23:48] 
[01:23:48] 
[01:23:48] thread 'ptr.rs - ptr::hash (line 2514)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:323:13
[01:23:48] 
[01:23:48] 
[01:23:48] failures:
[01:23:48]     ptr.rs - ptr::hash (line 2514)
[01:23:48]     ptr.rs - ptr::hash (line 2514)
[01:23:48] 
[01:23:48] test result: FAILED. 2170 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out
[01:23:48] 
[01:23:48] error: test failed, to rerun pass '--doc'
[01:23:48] 
[01:23:48] 
[01:23:48] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "core" "--" "--quiet"
[01:23:48] 
[01:23:48] 
[01:23:48] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:23:48] Build completed unsuccessfully in 0:37:29
[01:23:48] Build completed unsuccessfully in 0:37:29
[01:23:48] make: *** [check] Error 1
[01:23:48] Makefile:58: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:08896da4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Nov 27 18:24:01 UTC 2018

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 @TimNN. (Feature Requests)

@dwijnand

This comment has been minimized.

Copy link
Member

dwijnand commented Dec 1, 2018

CC @alexcrichton this would've made that interning code in Cargo look more symmetric :)

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 3, 2018

This seems like it's fine to me to add, but to align with ptr::eq should this perhaps take a raw pointer as well?

@dwijnand

This comment has been minimized.

Copy link
Member

dwijnand commented Dec 4, 2018

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 ptr::eq is happy to compare any raw pointer then I guess ptr::hash can hash any raw pointer, and the user can guard against passing it null pointers if need be.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 4, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:03752b1b:start=1543909813110345578,finish=1543909868985148801,duration=55874803223
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
184272 ./obj/build/cache/2018-10-30
153272 ./src/tools/clang
150332 ./obj/build/bootstrap/debug/incremental
134740 ./obj/build/bootstrap/debug/incremental/bootstrap-1plb86h2refwc
134736 ./obj/build/bootstrap/debug/incremental/bootstrap-1plb86h2refwc/s-f79qgjj7ni-1l6t9lv-4qyniat88vxc
134060 ./.git/modules/src
115340 ./src/llvm/test/CodeGen
107892 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
107416 ./src/tools/lldb
---
travis_time:end:25f9ff50:start=1543910111560666043,finish=1543910111565902426,duration=5236383
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1eddb1e6
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:044559c0
travis_time:start:044559c0
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:12bf5050
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

bors added a commit that referenced this pull request Dec 5, 2018

Auto merge of #56531 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 19 pull requests

Successful merges:

 - #51753 (Document `From` implementations)
 - #55563 (Improve no result found sentence in doc search)
 - #55933 (emit error when doc generation fails)
 - #55987 (Add Weak.ptr_eq)
 - #56119 (Utilize `?` instead of `return None`.)
 - #56250 (Introduce ptr::hash for references)
 - #56332 ([rustdoc] Specific crate search)
 - #56372 (Refer to the second borrow as the "second borrow" in E0501.rs)
 - #56388 (More MIR borrow check cleanup)
 - #56424 (Mention raw-ident syntax)
 - #56441 (rustbuild: Fix issues with compiler docs)
 - #56452 (Remove redundant clones)
 - #56456 (Handle existential types in dead code analysis)
 - #56466 (data_structures: remove tuple_slice)
 - #56476 (Fix invalid line number match)
 - #56497 (cleanup: remove static lifetimes from consts in libstd)
 - #56498 (Fix line numbers display)
 - #56523 (Added a bare-bones eslint config (removing jslint))
 - #56525 (Avoid extra copy and syscall in std::env::current_exe)

kennytm added a commit to GuillaumeGomez/rust that referenced this pull request Dec 5, 2018

Rollup merge of rust-lang#56250 - dwijnand:ptr-hash, r=alexcrichton
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. :)

bors added a commit that referenced this pull request Dec 5, 2018

Auto merge of #56531 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 19 pull requests

Successful merges:

 - #51753 (Document `From` implementations)
 - #55563 (Improve no result found sentence in doc search)
 - #55987 (Add Weak.ptr_eq)
 - #56010 (fix intra-link resolution spans in block comments)
 - #56119 (Utilize `?` instead of `return None`.)
 - #56250 (Introduce ptr::hash for references)
 - #56332 ([rustdoc] Specific crate search)
 - #56372 (Refer to the second borrow as the "second borrow" in E0501.rs)
 - #56388 (More MIR borrow check cleanup)
 - #56424 (Mention raw-ident syntax)
 - #56441 (rustbuild: Fix issues with compiler docs)
 - #56452 (Remove redundant clones)
 - #56456 (Handle existential types in dead code analysis)
 - #56466 (data_structures: remove tuple_slice)
 - #56476 (Fix invalid line number match)
 - #56497 (cleanup: remove static lifetimes from consts in libstd)
 - #56498 (Fix line numbers display)
 - #56523 (Added a bare-bones eslint config (removing jslint))
 - #56525 (Avoid extra copy and syscall in std::env::current_exe)

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 5, 2018

Rollup merge of rust-lang#56250 - dwijnand:ptr-hash, r=alexcrichton
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. :)
@@ -2509,6 +2509,36 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
a == b
}

/// Hash the raw pointer address behind a reference, rather than the value

This comment has been minimized.

@sinkuu

sinkuu Dec 6, 2018

Contributor

As now it's taking a pointer, "behind a reference" may need to be removed.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 6, 2018

⌛️ Testing commit ad76569 with merge 786b54f...

bors added a commit that referenced this pull request Dec 6, 2018

Auto merge of #56250 - dwijnand:ptr-hash, r=alexcrichton
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. :)
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 6, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 6, 2018

The job dist-aarch64-linux of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Building stage2 tool cargo (aarch64-unknown-linux-gnu)
[01:08:28]  Downloading crates ...
[01:08:48] warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: crates.io)
[01:09:08] warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: crates.io)
[01:09:28] error: failed to download from `https://crates.io/api/v1/crates/openssl-src/111.0.1+1.1.1/download`
[01:09:28] Caused by:
[01:09:28]   [6] Couldn't resolve host name (Could not resolve host: crates.io)
[01:09:28] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "aarch64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/tools/cargo/Cargo.toml" "--features" "rustc-workspace-hack/all-static" "--message-format" "json"
[01:09:28] expected success, got: exit code: 101
---
travis_time:end:1057ba42:start=1544077771498342503,finish=1544077771506399975,duration=8057472
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:132101c7
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1ed83885
travis_time:start:1ed83885
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0da61ed0
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Dec 6, 2018

kennytm added a commit to kennytm/rust that referenced this pull request Dec 7, 2018

Rollup merge of rust-lang#56250 - dwijnand:ptr-hash, r=alexcrichton
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. :)

@kennytm kennytm referenced this pull request Dec 7, 2018

Merged

Rollup of 7 pull requests #56581

bors added a commit that referenced this pull request Dec 7, 2018

Auto merge of #56581 - kennytm:rollup, r=kennytm
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

bors added a commit that referenced this pull request Dec 7, 2018

Auto merge of #56581 - kennytm:rollup, r=kennytm
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
@dwijnand

This comment has been minimized.

Copy link
Member

dwijnand commented Dec 7, 2018

As now it's taking a pointer, "behind a reference" may need to be removed.

@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.

@bors bors merged commit ad76569 into rust-lang:master Dec 7, 2018

1 of 2 checks passed

homu Test failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@dwijnand dwijnand deleted the dwijnand:ptr-hash branch Dec 7, 2018

@dwijnand

This comment has been minimized.

Copy link
Member

dwijnand commented Dec 7, 2018

Followed up in #56602.

Centril added a commit to Centril/rust that referenced this pull request Dec 8, 2018

Rollup merge of rust-lang#56602 - dwijnand:fix-ptr-hash-docs, r=Centril
Fix the just-introduced ptr::hash docs

Follow-up to rust-lang#56250.

kennytm added a commit to kennytm/rust that referenced this pull request Dec 14, 2018

Rollup merge of rust-lang#56751 - mbrubeck:hash, r=dtolnay
Allow ptr::hash to accept fat pointers

Fat pointers implement Hash since rust-lang#45483.  This is a follow-up to rust-lang#56250.

kennytm added a commit to kennytm/rust that referenced this pull request Dec 14, 2018

Rollup merge of rust-lang#56751 - mbrubeck:hash, r=dtolnay
Allow ptr::hash to accept fat pointers

Fat pointers implement Hash since rust-lang#45483.  This is a follow-up to rust-lang#56250.

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 14, 2018

Rollup merge of rust-lang#56751 - mbrubeck:hash, r=dtolnay
Allow ptr::hash to accept fat pointers

Fat pointers implement Hash since rust-lang#45483.  This is a follow-up to rust-lang#56250.

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 15, 2018

Rollup merge of rust-lang#56751 - mbrubeck:hash, r=dtolnay
Allow ptr::hash to accept fat pointers

Fat pointers implement Hash since rust-lang#45483.  This is a follow-up to rust-lang#56250.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment