Skip to content
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

Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S> #58370

Merged
merged 1 commit into from Feb 25, 2019

Conversation

@nox
Copy link
Contributor

commented Feb 11, 2019

Notably, hash iterators don't require any trait bounds to be iterated.

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Feb 11, 2019

r? @withoutboats

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

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Feb 11, 2019

The job x86_64-gnu-llvm-6.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:0bb57674:start=1549883007691695116,finish=1549883080850997965,duration=73159302849
$ 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-6.0
---
[00:05:23]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[00:05:23]    Compiling rustc-demangle v0.1.10
[00:05:23]    Compiling panic_abort v0.0.0 (/checkout/src/libpanic_abort)
[00:05:28]    Compiling panic_unwind v0.0.0 (/checkout/src/libpanic_unwind)
[00:05:30] error[E0599]: no method named `raw_capacity` found for type `&collections::hash::map::HashMap<K, V, S>` in the current scope
[00:05:30]     |
[00:05:30]     |
[00:05:30] 754 |         self.resize_policy.capacity(self.raw_capacity())
[00:05:30]     |
[00:05:30]     |
[00:05:30]     = note: the method `raw_capacity` exists but the following trait bounds were not satisfied:
[00:05:30]             `K : core::cmp::Eq`
[00:05:30]             `K : core::hash::Hash`
[00:05:30]             `S : core::hash::BuildHasher`
[00:05:30]     = help: did you mean `capacity`?
[00:05:30] error[E0308]: mismatched types
[00:05:30]     --> src/libstd/collections/hash/set.rs:1106:26
[00:05:30]      |
[00:05:30]      |
[00:05:30] 1106 |         IntoIter { iter: self.map.into_iter() }
[00:05:30]      |                          ^^^^^^^^^^^^^^^^^^^^ expected struct `collections::hash::map::IntoIter`, found struct `collections::hash::map::Iter`
[00:05:30]      |
[00:05:30]      = note: expected type `collections::hash::map::IntoIter<T, ()>`
[00:05:30]                 found type `collections::hash::map::Iter<'_, T, ()>`
[00:05:32] error: aborting due to 2 previous errors
[00:05:32] 
[00:05:32] Some errors occurred: E0308, E0599.
[00:05:32] For more information about an error, try `rustc --explain E0308`.
[00:05:32] For more information about an error, try `rustc --explain E0308`.
[00:05:32] error: Could not compile `std`.
[00:05:32] 
[00:05:32] To learn more, run the command again with --verbose.
[00:05:32] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:05:32] expected success, got: exit code: 101
[00:05:32] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:05:32] Build completed unsuccessfully in 0:00:45
[00:05:32] Makefile:18: recipe for target 'all' failed
[00:05:32] make: *** [all] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1ea9f618
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Feb 11 11:10:22 UTC 2019
---
travis_time:end:0bc97597:start=1549883423057842165,finish=1549883423062193761,duration=4351596
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:119f24c4
$ 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:01b9d974
travis_time:start:01b9d974
$ 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:0383054d
$ 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)

@nox nox force-pushed the nox:relax-bounds branch from 9d79915 to 8fb2525 Feb 11, 2019

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Feb 11, 2019

The job x86_64-gnu-llvm-6.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:03bdf460:start=1549883860523314569,finish=1549883937418204613,duration=76894890044
$ 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-6.0
---
[00:59:58] .................................................................................................... 2200/5380
[01:00:02] .................................................................................................... 2300/5380
[01:00:06] .................................................................................................... 2400/5380
[01:00:10] .................................................................................................... 2500/5380
[01:00:14] .............................................F...................................................... 2600/5380
[01:00:23] .................................................................................................... 2800/5380
[01:00:27] .................................................................................................... 2900/5380
[01:00:31] .................................................................................................... 3000/5380
[01:00:34] .................................................................................................... 3100/5380
---
[01:02:06] 
[01:02:06] ---- [ui] ui/issues/issue-35677.rs stdout ----
[01:02:06] diff of stderr:
[01:02:06] 
[01:02:06] - error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
[01:02:06] + error[E0308]: mismatched types
[01:02:06] +   --> $DIR/issue-35677.rs:3:5
[01:02:06] 3    |
[01:02:06] 3    |
[01:02:06] + LL | fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
[01:02:06] +    |                                                                           ---- expected `bool` because of return type
[01:02:06] 4 LL |     this.drain()
[01:02:06] +    |     ^^^^^^^^^^^^ expected bool, found struct `std::collections::hash_map::Drain`
[01:02:06] 6    |
[01:02:06] 6    |
[01:02:06] -    = note: the method `drain` exists but the following trait bounds were not satisfied:
[01:02:06] -            `K : std::cmp::Eq`
[01:02:06] -            `K : std::hash::Hash`
[01:02:06] +    = note: expected type `bool`
[01:02:06] +               found type `std::collections::hash_map::Drain<'_, K, V>`
[01:02:06] 11 error: aborting due to previous error
[01:02:06] 12 
[01:02:06] 
[01:02:06] - For more information about this error, try `rustc --explain E0599`.
[01:02:06] - For more information about this error, try `rustc --explain E0599`.
[01:02:06] + For more information about this error, try `rustc --explain E0308`.
[01:02:06] 14 
[01:02:06] 
[01:02:06] 
[01:02:06] The actual stderr differed from the expected stderr.
[01:02:06] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/issue-35677.stderr
[01:02:06] To update references, rerun the tests and pass the `--bless` flag
[01:02:06] To only update this specific test, also pass `--test-args issues/issue-35677.rs`
[01:02:06] error: 1 errors occurred comparing output.
[01:02:06] status: exit code: 1
[01:02:06] status: exit code: 1
[01:02:06] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-35677.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/auxiliary" "-A" "unused"
[01:02:06] ------------------------------------------
[01:02:06] 
[01:02:06] ------------------------------------------
[01:02:06] stderr:
[01:02:06] stderr:
[01:02:06] ------------------------------------------
[01:02:06] {"message":"mismatched types","code":{"code":"E0308","explanation":"\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can occur for several cases, the most common of which is a\nmismatch in the expected type that the compiler inferred for a variable's\ninitializing expression, and the actual type explicitly assigned to the\nvariable.\n\nFor example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n//     ~~~   ~~~~~~~~~~~~~~~~~~~~\n//      |             |\n//      |    initializing expression;\n//      |    compiler infers type `&str`\n//      |\n//    type `i32` assigned to variable `x`\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-35677.rs","byte_start":116,"byte_end":128,"line_start":3,"line_end":3,"column_start":5,"column_end":17,"is_primary":true,"text":[{"text":"    this.drain()","highlight_start":5,"highlight_end":17}],"label":"expected bool, found struct `std::collections::hash_map::Drain`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issues/issue-35677.rs","byte_start":105,"byte_end":109,"line_start":2,"line_end":2,"column_start":75,"column_end":79,"is_primary":false,"text":[{"text":"fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {","highlight_start":75,"highlight_end":79}],"label":"expected `bool` because of return type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `bool`\n   found type `std::collections::hash_map::Drain<'_, K, V>`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0308]: mismatched types\n  --> /checkout/src/test/ui/issues/issue-35677.rs:3:5\n   |\nLL | fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {\n   |                                                                           ---- expected `bool` because of return type\nLL |     this.drain()\n   |     ^^^^^^^^^^^^ expected bool, found struct `std::collections::hash_map::Drain`\n   |\n   = note: expected type `bool`\n              found type `std::collections::hash_map::Drain<'_, K, V>`\n\n"}
[01:02:06] {"message":"For more information about this error, try `rustc --explain E0308`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0308`.\n"}
[01:02:06] 
[01:02:06] ------------------------------------------
[01:02:06] 
---
[01:02:06] 
[01:02:06] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:02:06] 
[01:02:06] 
[01:02:06] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:02:06] 
[01:02:06] 
[01:02:06] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:02:06] Build completed unsuccessfully in 0:04:27
[01:02:06] Build completed unsuccessfully in 0:04:27
[01:02:06] make: *** [check] Error 1
[01:02:06] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:080e3d1c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Feb 11 12:21:14 UTC 2019
---
travis_time:end:21df20b7:start=1549887675931567109,finish=1549887675936415104,duration=4847995
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:2638dd9c
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!che

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)

@nox nox force-pushed the nox:relax-bounds branch from 8fb2525 to 090e60f Feb 11, 2019

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

@Centril

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

Could you give a full example of when this would be useful? In particular, to construct a HashMap you need to show that K: Eq + Hash, S: BuildHasher.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Feb 11, 2019

The job x86_64-gnu-llvm-6.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:042adcf4:start=1549889491878821295,finish=1549889636913451617,duration=145034630322
$ 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-6.0
---
[01:03:23] .................................................................................................... 2200/5380
[01:03:27] .................................................................................................... 2300/5380
[01:03:31] .................................................................................................... 2400/5380
[01:03:36] .................................................................................................... 2500/5380
[01:03:40] ..........................................F......................................................... 2600/5380
[01:03:49] .................................................................................................... 2800/5380
[01:03:53] .................................................................................................... 2900/5380
[01:03:57] .................................................................................................... 3000/5380
[01:04:00] .................................................................................................... 3100/5380
---
[01:05:36] 
[01:05:36] ---- [ui] ui/issues/issue-35677.rs stdout ----
[01:05:36] diff of stderr:
[01:05:36] 
[01:05:36] - error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
[01:05:36] -   --> $DIR/issue-35677.rs:3:10
[01:05:36] + error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope
[01:05:36] 3    |
[01:05:36] 3    |
[01:05:36] - LL |     this.drain()
[01:05:36] -    |          ^^^^^
[01:05:36] + LL |     this.is_subset(other)
[01:05:36] 6    |
[01:05:36] 6    |
[01:05:36] -    = note: the method `drain` exists but the following trait bounds were not satisfied:
[01:05:36] -            `K : std::cmp::Eq`
[01:05:36] -            `K : std::hash::Hash`
[01:05:36] +    = note: the method `is_subset` exists but the following trait bounds were not satisfied:
[01:05:36] +            `T : std::cmp::Eq`
[01:05:36] +            `T : std::hash::Hash`
[01:05:36] 11 error: aborting due to previous error
[01:05:36] 12 
[01:05:36] 
[01:05:36] 
[01:05:36] 
[01:05:36] The actual stderr differed from the expected stderr.
[01:05:36] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/issue-35677.stderr
[01:05:36] To update references, rerun the tests and pass the `--bless` flag
[01:05:36] To only update this specific test, also pass `--test-args issues/issue-35677.rs`
[01:05:36] error: 1 errors occurred comparing output.
[01:05:36] status: exit code: 1
[01:05:36] status: exit code: 1
[01:05:36] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-35677.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/auxiliary" "-A" "unused"
[01:05:36] ------------------------------------------
[01:05:36] 
[01:05:36] ------------------------------------------
[01:05:36] stderr:
[01:05:36] stderr:
[01:05:36] ------------------------------------------
[01:05:36] {"message":"no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-35677.rs","byte_start":106,"byte_end":115,"line_start":4,"line_end":4,"column_start":10,"column_end":19,"is_primary":true,"text":[{"text":"    this.is_subset(other)","highlight_start":10,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `is_subset` exists but the following trait bounds were not satisfied:\n`T : std::cmp::Eq`\n`T : std::hash::Hash`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-35677.rs:4:10\n   |\nLL |     this.is_subset(other)\n   |          ^^^^^^^^^\n   |\n   = note: the method `is_subset` exists but the following trait bounds were not satisfied:\n           `T : std::cmp::Eq`\n           `T : std::hash::Hash`\n\n"}
[01:05:36] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:05:36] 
[01:05:36] ------------------------------------------
[01:05:36] 
---
[01:05:36] 
[01:05:36] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:05:36] 
[01:05:36] 
[01:05:36] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:05:36] 
[01:05:36] 
[01:05:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:05:36] Build completed unsuccessfully in 0:04:38
[01:05:36] Build completed unsuccessfully in 0:04:38
[01:05:36] Makefile:48: recipe for target 'check' failed
[01:05:36] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:23a82bd0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Feb 11 13:59:44 UTC 2019

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)

@nox nox force-pushed the nox:relax-bounds branch from c1ce394 to 090e60f Feb 11, 2019

@nox

This comment has been minimized.

Copy link
Contributor Author

commented Feb 11, 2019

Could you give a full example of when this would be useful? In particular, to construct a HashMap you need to show that K: Eq + Hash, S: BuildHasher.

Short answer: I shouldn't have to add K: Eq + Hash, S: BuildHasher to a function that takes a hash map and just iterates it.

Long answer: I do fancy things in this project of mine, in which I pointer cast &HashMap<K, V, S> to &HashMap<Inert<K>, Inert<V>, Inert<S>> to provide a Sync way to access non-Sync values.

Also, all other collections (apart from BTreeMap<K, V> which I will handle in a separate PR) work this way, with an unbounded iter() implementation, and the Iterator implementations themselves of the various HashMap<K, V, S> iterators don't have those bounds.

@Centril

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

Short answer: I shouldn't have to add K: Eq + Hash, S: BuildHasher to a function that takes a hash map and just iterates it.

That is dealt with by #44491.

Long answer: I do fancy things in this project of mine, in which I pointer cast &HashMap<K, V, S> to &HashMap<Inert<K>, Inert<V>, Inert<S>> to provide a Sync way to access non-Sync values.

Ah; thanks. Btw.. Inert should probably have #[repr(transparent)]?

@nox

This comment has been minimized.

Copy link
Contributor Author

commented Feb 11, 2019

That is dealt with by #44491.

I don't think you can call that "dealt with", given that means adding bounds to that collection when, say, BTreeMap won't ever have any because that would be a breaking change.

@Centril

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

That is dealt with by #44491.

I don't think you can call that "dealt with", given that means adding bounds to that collection when, say, BTreeMap won't ever have any because that would be a breaking change.

Yeah, that's fair.

@nox nox force-pushed the nox:relax-bounds branch from 090e60f to d276b9f Feb 11, 2019

/// let hasher: &RandomState = map.hasher();
/// ```
#[stable(feature = "hashmap_public_hasher", since = "1.9.0")]
pub fn hasher(&self) -> &S {

This comment has been minimized.

Copy link
@Amanieu

Amanieu Feb 11, 2019

Contributor

I would prefer if this function kept the S: BuildHasher bound. I have some changes to hashbrown (which will soon replace the libstd hashmap) which may require this bound in the future.

Do you really need to call map.hasher() without a S: BuildHasher bound? If you really need it then I can try looking into a workaround, but it might get a bit ugly.

This comment has been minimized.

Copy link
@nox

nox Feb 11, 2019

Author Contributor

Do you really need to call map.hasher() without a S: BuildHasher bound? If you really need it then I can try looking into a workaround, but it might get a bit ugly.

Nope, it was just one of the methods I saw that didn't need a bound, I can add it back.

This comment has been minimized.

Copy link
@Amanieu

Amanieu Feb 11, 2019

Contributor

Please do.

This comment has been minimized.

Copy link
@nox

nox Feb 11, 2019

Author Contributor

I moved it back where it was before with the same bounds.

@Amanieu

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

Apart from my concern on hasher, I have no objection to the changes on iterators.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Feb 11, 2019

The job x86_64-gnu-llvm-6.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:09a1dfec:start=1549902707222763773,finish=1549902805627259766,duration=98404495993
$ 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-6.0
---
[01:00:34] .................................................................................................... 2200/5380
[01:00:38] .................................................................................................... 2300/5380
[01:00:42] .................................................................................................... 2400/5380
[01:00:46] .................................................................................................... 2500/5380
[01:00:49] ...........................................F........................................................ 2600/5380
[01:00:57] .................................................................................................... 2800/5380
[01:01:01] .................................................................................................... 2900/5380
[01:01:05] .................................................................................................... 3000/5380
[01:01:08] .................................................................................................... 3100/5380
---
[01:02:31] 
[01:02:31] ---- [ui] ui/issues/issue-35677.rs stdout ----
[01:02:31] diff of stderr:
[01:02:31] 
[01:02:31] 1 error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope
[01:02:31] +   --> $DIR/issue-35677.rs:4:10
[01:02:31] 3    |
[01:02:31] 3    |
[01:02:31] 4 LL |     this.is_subset(other)
[01:02:31] 
[01:02:31] 
[01:02:31] The actual stderr differed from the expected stderr.
[01:02:31] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/issue-35677.stderr
[01:02:31] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/issue-35677.stderr
[01:02:31] To update references, rerun the tests and pass the `--bless` flag
[01:02:31] To only update this specific test, also pass `--test-args issues/issue-35677.rs`
[01:02:31] error: 1 errors occurred comparing output.
[01:02:31] status: exit code: 1
[01:02:31] status: exit code: 1
[01:02:31] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-35677.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-35677/auxiliary" "-A" "unused"
[01:02:31] ------------------------------------------
[01:02:31] 
[01:02:31] ------------------------------------------
[01:02:31] stderr:
[01:02:31] stderr:
[01:02:31] ------------------------------------------
[01:02:31] {"message":"no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope","code":{"code":"E0599","explanation":"\nThis error occurs when a method is used on a type which doesn't implement it:\n\nErroneous code example:\n\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-35677.rs","byte_start":106,"byte_end":115,"line_start":4,"line_end":4,"column_start":10,"column_end":19,"is_primary":true,"text":[{"text":"    this.is_subset(other)","highlight_start":10,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the method `is_subset` exists but the following trait bounds were not satisfied:\n`T : std::cmp::Eq`\n`T : std::hash::Hash`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope\n  --> /checkout/src/test/ui/issues/issue-35677.rs:4:10\n   |\nLL |     this.is_subset(other)\n   |          ^^^^^^^^^\n   |\n   = note: the method `is_subset` exists but the following trait bounds were not satisfied:\n           `T : std::cmp::Eq`\n           `T : std::hash::Hash`\n\n"}
[01:02:31] {"message":"For more information about this error, try `rustc --explain E0599`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0599`.\n"}
[01:02:31] 
[01:02:31] ------------------------------------------
[01:02:31] 
---
[01:02:31] 
[01:02:31] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:02:31] 
[01:02:31] 
[01:02:31] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:02:31] 
[01:02:31] 
[01:02:31] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:02:31] Build completed unsuccessfully in 0:04:09
[01:02:31] Build completed unsuccessfully in 0:04:09
[01:02:31] make: *** [check] Error 1
[01:02:31] Makefile:48: recipe for target 'check' failed
141200 ./obj/build/bootstrap/debug/incremental/bootstrap-2ahv8almm435e
141200 ./obj/build/bootstrap/debug/incremental/bootstrap-2ahv8almm435e
141196 ./obj/build/bootstrap/debug/incremental/bootstrap-2ahv8almm435e/s-f9e7lytw3c-1ohh389-170x7pprjykmo
137092 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release
134316 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps
123292 ./src/llvm-project/llvm/test/CodeGen
108528 ./src/llvm-project/lldb

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)

@nox nox force-pushed the nox:relax-bounds branch from d276b9f to 726e16c Feb 11, 2019

@Amanieu

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

Assuming the change for hasher is reverted.

@rfcbot fcp merge

@nox nox force-pushed the nox:relax-bounds branch 3 times, most recently from 6879128 to 82fb122 Feb 11, 2019

@rfcbot

This comment has been minimized.

Copy link

commented Feb 11, 2019

Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@scottmcm

This comment has been minimized.

Copy link
Member

commented Feb 11, 2019

Awesome! I just wanted this the other day 🙂

(Same kind of things as nox already mentioned: passed a &HashMap into a function, and was annoyed at how many bounds I had to add when it was clearly not even possible to modify it.)

@nox nox force-pushed the nox:relax-bounds branch from f104503 to 82fb122 Feb 12, 2019

@nox

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2019

Pushed a commit that I didn't intend to push directly in that PR, but I guess maybe I should? I did a similar patch for BTreeMap<K, V>.

@nox

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2019

Sorry, I meant BinaryHeap<T>.

@bors

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2019

☔️ The latest upstream changes (presumably #58341) made this pull request unmergeable. Please resolve the merge conflicts.

Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>
Notably, hash iterators don't require any trait bounds to be iterated.

@nox nox force-pushed the nox:relax-bounds branch from 82fb122 to d9e2259 Feb 13, 2019

@dtolnay

This comment has been minimized.

Copy link
Member

commented Feb 14, 2019

@rfcbot reviewed

under the understanding that the set of API changes is:

  impl<K, V, S> HashMap<K, V, S>
- where
-     K: Eq + Hash,
-     S: BuildHasher,
  {
      fn capacity(&self) -> usize;
      fn keys(&self) -> Keys<K, V>;
      fn values(&self) -> Values<K, V>;
      fn values_mut(&mut self) -> ValuesMut<K, V>;
      fn iter(&self) -> Iter<K, V>;
      fn iter_mut(&mut self) -> IterMut<K, V>;
      fn len(&self) -> usize;
      fn is_empty(&self) -> bool;
      fn drain(&mut self) -> Drain<K, V>;
      fn clear(&mut self);
  }

  impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
- where
-     K: Eq + Hash,
-     S: BuildHasher;

  impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
- where
-     K: Eq + Hash,
-     S: BuildHasher;

  impl<K, V, S> IntoIterator for HashMap<K, V, S>
- where
-     K: Eq + Hash,
-     S: BuildHasher;

  impl<T, S> HashSet<T, S>
- where
-     T: Eq + Hash,
-     S: BuildHasher,
  {
      fn capacity(&self) -> usize;
      fn iter(&self) -> Iter<T>;
      fn len(&self) -> usize;
      fn is_empty(&self) -> bool;
      fn drain(&mut self) -> Drain<T>;
      fn clear(&mut self);
  }

  impl<'a, T, S> IntoIterator for &'a HashSet<T, S>
- where
-     T: Eq + Hash,
-     S: BuildHasher;

  impl<T, S> IntoIterator for HashSet<T, S>
- where
-     T: Eq + Hash,
-     S: BuildHasher;
@dtolnay

This comment has been minimized.

Copy link
Member

commented Feb 14, 2019

Is it possible that drain would want to shrink and rehash things?

Edit: never mind, this isn't like Vec::drain where there can be items left afterward.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

Currently HashMap and Vec never shrink implicitly, only when a dedicated method like shrink_to_fit is called. If the collection happens to grow again later, this saves on allocator traffic.

@rfcbot

This comment has been minimized.

Copy link

commented Feb 14, 2019

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot

This comment has been minimized.

Copy link

commented Feb 24, 2019

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process,I would like to thank @sfacklerfor their work and everyone else who contributed.

The RFC will be merged soon.

@dtolnay

This comment has been minimized.

Copy link
Member

commented Feb 25, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2019

📌 Commit d9e2259 has been approved by dtolnay

Centril added a commit to Centril/rust that referenced this pull request Feb 25, 2019

Rollup merge of rust-lang#58370 - nox:relax-bounds, r=dtolnay
Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>

Notably, hash iterators don't require any trait bounds to be iterated.

bors added a commit that referenced this pull request Feb 25, 2019

Auto merge of #58714 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #58370 (Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>)
 - #58421 (Relax some Ord bounds on BinaryHeap<T>)
 - #58686 (replace deprecated rustfmt_skip with rustfmt::skip)
 - #58697 (Use ? in some macros)
 - #58704 (Remove some unnecessary 'extern crate')

Failed merges:

r? @ghost

@bors bors merged commit d9e2259 into rust-lang:master Feb 25, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 14, 2019

he
Update rust to version 1.34.0.
Pkgsrc changes:
 * Bump required rust version to build to 1.33.0.
 * Adapt patches to changed file locations.
 * (I worry about 32-bit ports, now that Atomic64 apparently is First-Class;
   this has been built on NetBSD/amd64 so far)

Upstream changes:

Version 1.34.0 (2019-04-11)
==========================

Language
--------
- [You can now use `#[deprecated = "reason"]`][58166] as a shorthand for
  `#[deprecated(note = "reason")]`. This was previously allowed by mistake
  but had no effect.
- [You can now accept token streams in `#[attr()]`,`#[attr[]]`, and
  `#[attr{}]` procedural macros.][57367]
- [You can now write `extern crate self as foo;`][57407] to import your
  crate's root into the extern prelude.


Compiler
--------
- [You can now target `riscv64imac-unknown-none-elf` and
  `riscv64gc-unknown-none-elf`.][58406]
- [You can now enable linker plugin LTO optimisations with
  `-C linker-plugin-lto`.][58057] This allows rustc to compile your Rust code
  into LLVM bitcode allowing LLVM to perform LTO optimisations across C/C++ FFI
  boundaries.
- [You can now target `powerpc64-unknown-freebsd`.][57809]


Libraries
---------
- [The trait bounds have been removed on some of `HashMap<K, V, S>`'s and
  `HashSet<T, S>`'s basic methods.][58370] Most notably you no longer require
  the `Hash` trait to create an iterator.
- [The `Ord` trait bounds have been removed on some of `BinaryHeap<T>`'s basic
  methods.][58421] Most notably you no longer require the `Ord` trait to create
  an iterator.
- [The methods `overflowing_neg` and `wrapping_neg` are now `const` functions
  for all numeric types.][58044]
- [Indexing a `str` is now generic over all types that
  implement `SliceIndex<str>`.][57604]
- [`str::trim`, `str::trim_matches`, `str::trim_{start, end}`, and
  `str::trim_{start, end}_matches` are now `#[must_use]`][57106] and will
  produce a warning if their returning type is unused.
- [The methods `checked_pow`, `saturating_pow`, `wrapping_pow`, and
  `overflowing_pow` are now available for all numeric types.][57873] These are
  equivalvent to methods such as `wrapping_add` for the `pow` operation.


Stabilized APIs
---------------

#### std & core
* [`Any::type_id`]
* [`Error::type_id`]
* [`atomic::AtomicI16`]
* [`atomic::AtomicI32`]
* [`atomic::AtomicI64`]
* [`atomic::AtomicI8`]
* [`atomic::AtomicU16`]
* [`atomic::AtomicU32`]
* [`atomic::AtomicU64`]
* [`atomic::AtomicU8`]
* [`convert::Infallible`]
* [`convert::TryFrom`]
* [`convert::TryInto`]
* [`iter::from_fn`]
* [`iter::successors`]
* [`num::NonZeroI128`]
* [`num::NonZeroI16`]
* [`num::NonZeroI32`]
* [`num::NonZeroI64`]
* [`num::NonZeroI8`]
* [`num::NonZeroIsize`]
* [`slice::sort_by_cached_key`]
* [`str::escape_debug`]
* [`str::escape_default`]
* [`str::escape_unicode`]
* [`str::split_ascii_whitespace`]

#### std
* [`Instant::checked_add`]
* [`Instant::checked_sub`]
* [`SystemTime::checked_add`]
* [`SystemTime::checked_sub`]

Cargo
-----
- [You can now use alternative registries to crates.io.][cargo/6654]

Misc
----
- [You can now use the `?` operator in your documentation tests without manually
  adding `fn main() -> Result<(), _> {}`.][56470]

Compatibility Notes
-------------------
- [`Command::before_exec` is now deprecated in favor of the
  unsafe method `Command::pre_exec`.][58059]
- [Use of `ATOMIC_{BOOL, ISIZE, USIZE}_INIT` is now deprecated.][57425] As you
  can now use `const` functions in `static` variables.

[58370]: rust-lang/rust#58370
[58406]: rust-lang/rust#58406
[58421]: rust-lang/rust#58421
[58166]: rust-lang/rust#58166
[58044]: rust-lang/rust#58044
[58057]: rust-lang/rust#58057
[58059]: rust-lang/rust#58059
[57809]: rust-lang/rust#57809
[57873]: rust-lang/rust#57873
[57604]: rust-lang/rust#57604
[57367]: rust-lang/rust#57367
[57407]: rust-lang/rust#57407
[57425]: rust-lang/rust#57425
[57106]: rust-lang/rust#57106
[56470]: rust-lang/rust#56470
[cargo/6654]: rust-lang/cargo#6654
[`Any::type_id`]: https://doc.rust-lang.org/std/any/trait.Any.html#tymethod.type_id
[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.type_id
[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI16.html
[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI32.html
[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI64.html
[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI8.html
[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU16.html
[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU32.html
[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU64.html
[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU8.html
[`convert::Infallible`]: https://doc.rust-lang.org/std/convert/enum.Infallible.html
[`convert::TryFrom`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html
[`convert::TryInto`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html
[`iter::from_fn`]: https://doc.rust-lang.org/std/iter/fn.from_fn.html
[`iter::successors`]: https://doc.rust-lang.org/std/iter/fn.successors.html
[`num::NonZeroI128`]: https://doc.rust-lang.org/std/num/struct.NonZeroI128.html
[`num::NonZeroI16`]: https://doc.rust-lang.org/std/num/struct.NonZeroI16.html
[`num::NonZeroI32`]: https://doc.rust-lang.org/std/num/struct.NonZeroI32.html
[`num::NonZeroI64`]: https://doc.rust-lang.org/std/num/struct.NonZeroI64.html
[`num::NonZeroI8`]: https://doc.rust-lang.org/std/num/struct.NonZeroI8.html
[`num::NonZeroIsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroIsize.html
[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/slice/fn.sort_by_cached_key
[`str::escape_debug`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_debug
[`str::escape_default`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_default
[`str::escape_unicode`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_unicode
[`str::split_ascii_whitespace`]: https://doc.rust-lang.org/std/primitive.str.html#method.split_ascii_whitespace
[`Instant::checked_add`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_add
[`Instant::checked_sub`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_sub
[`SystemTime::checked_add`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.checked_add
[`SystemTime::checked_sub`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.checked_sub

@Centril Centril added this to the 1.34 milestone Apr 26, 2019

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 19, 2019

he
Update rust to version 1.34.0.
Pkgsrc changes:
 * Bump required rust version to build to 1.33.0.
 * Adapt patches to changed file locations.
 * (I worry about 32-bit ports, now that Atomic64 apparently is First-Class;
   this has been built on NetBSD/amd64 so far)

Upstream changes:

Version 1.34.0 (2019-04-11)
==========================

Language
--------
- [You can now use `#[deprecated = "reason"]`][58166] as a shorthand for
  `#[deprecated(note = "reason")]`. This was previously allowed by mistake
  but had no effect.
- [You can now accept token streams in `#[attr()]`,`#[attr[]]`, and
  `#[attr{}]` procedural macros.][57367]
- [You can now write `extern crate self as foo;`][57407] to import your
  crate's root into the extern prelude.


Compiler
--------
- [You can now target `riscv64imac-unknown-none-elf` and
  `riscv64gc-unknown-none-elf`.][58406]
- [You can now enable linker plugin LTO optimisations with
  `-C linker-plugin-lto`.][58057] This allows rustc to compile your Rust code
  into LLVM bitcode allowing LLVM to perform LTO optimisations across C/C++ FFI
  boundaries.
- [You can now target `powerpc64-unknown-freebsd`.][57809]


Libraries
---------
- [The trait bounds have been removed on some of `HashMap<K, V, S>`'s and
  `HashSet<T, S>`'s basic methods.][58370] Most notably you no longer require
  the `Hash` trait to create an iterator.
- [The `Ord` trait bounds have been removed on some of `BinaryHeap<T>`'s basic
  methods.][58421] Most notably you no longer require the `Ord` trait to create
  an iterator.
- [The methods `overflowing_neg` and `wrapping_neg` are now `const` functions
  for all numeric types.][58044]
- [Indexing a `str` is now generic over all types that
  implement `SliceIndex<str>`.][57604]
- [`str::trim`, `str::trim_matches`, `str::trim_{start, end}`, and
  `str::trim_{start, end}_matches` are now `#[must_use]`][57106] and will
  produce a warning if their returning type is unused.
- [The methods `checked_pow`, `saturating_pow`, `wrapping_pow`, and
  `overflowing_pow` are now available for all numeric types.][57873] These are
  equivalvent to methods such as `wrapping_add` for the `pow` operation.


Stabilized APIs
---------------

#### std & core
* [`Any::type_id`]
* [`Error::type_id`]
* [`atomic::AtomicI16`]
* [`atomic::AtomicI32`]
* [`atomic::AtomicI64`]
* [`atomic::AtomicI8`]
* [`atomic::AtomicU16`]
* [`atomic::AtomicU32`]
* [`atomic::AtomicU64`]
* [`atomic::AtomicU8`]
* [`convert::Infallible`]
* [`convert::TryFrom`]
* [`convert::TryInto`]
* [`iter::from_fn`]
* [`iter::successors`]
* [`num::NonZeroI128`]
* [`num::NonZeroI16`]
* [`num::NonZeroI32`]
* [`num::NonZeroI64`]
* [`num::NonZeroI8`]
* [`num::NonZeroIsize`]
* [`slice::sort_by_cached_key`]
* [`str::escape_debug`]
* [`str::escape_default`]
* [`str::escape_unicode`]
* [`str::split_ascii_whitespace`]

#### std
* [`Instant::checked_add`]
* [`Instant::checked_sub`]
* [`SystemTime::checked_add`]
* [`SystemTime::checked_sub`]

Cargo
-----
- [You can now use alternative registries to crates.io.][cargo/6654]

Misc
----
- [You can now use the `?` operator in your documentation tests without manually
  adding `fn main() -> Result<(), _> {}`.][56470]

Compatibility Notes
-------------------
- [`Command::before_exec` is now deprecated in favor of the
  unsafe method `Command::pre_exec`.][58059]
- [Use of `ATOMIC_{BOOL, ISIZE, USIZE}_INIT` is now deprecated.][57425] As you
  can now use `const` functions in `static` variables.

[58370]: rust-lang/rust#58370
[58406]: rust-lang/rust#58406
[58421]: rust-lang/rust#58421
[58166]: rust-lang/rust#58166
[58044]: rust-lang/rust#58044
[58057]: rust-lang/rust#58057
[58059]: rust-lang/rust#58059
[57809]: rust-lang/rust#57809
[57873]: rust-lang/rust#57873
[57604]: rust-lang/rust#57604
[57367]: rust-lang/rust#57367
[57407]: rust-lang/rust#57407
[57425]: rust-lang/rust#57425
[57106]: rust-lang/rust#57106
[56470]: rust-lang/rust#56470
[cargo/6654]: rust-lang/cargo#6654
[`Any::type_id`]: https://doc.rust-lang.org/std/any/trait.Any.html#tymethod.type_id
[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.type_id
[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI16.html
[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI32.html
[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI64.html
[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI8.html
[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU16.html
[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU32.html
[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU64.html
[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU8.html
[`convert::Infallible`]: https://doc.rust-lang.org/std/convert/enum.Infallible.html
[`convert::TryFrom`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html
[`convert::TryInto`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html
[`iter::from_fn`]: https://doc.rust-lang.org/std/iter/fn.from_fn.html
[`iter::successors`]: https://doc.rust-lang.org/std/iter/fn.successors.html
[`num::NonZeroI128`]: https://doc.rust-lang.org/std/num/struct.NonZeroI128.html
[`num::NonZeroI16`]: https://doc.rust-lang.org/std/num/struct.NonZeroI16.html
[`num::NonZeroI32`]: https://doc.rust-lang.org/std/num/struct.NonZeroI32.html
[`num::NonZeroI64`]: https://doc.rust-lang.org/std/num/struct.NonZeroI64.html
[`num::NonZeroI8`]: https://doc.rust-lang.org/std/num/struct.NonZeroI8.html
[`num::NonZeroIsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroIsize.html
[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/slice/fn.sort_by_cached_key
[`str::escape_debug`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_debug
[`str::escape_default`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_default
[`str::escape_unicode`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_unicode
[`str::split_ascii_whitespace`]: https://doc.rust-lang.org/std/primitive.str.html#method.split_ascii_whitespace
[`Instant::checked_add`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_add
[`Instant::checked_sub`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_sub
[`SystemTime::checked_add`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.checked_add
[`SystemTime::checked_sub`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.checked_sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.