kyren / hashlink

An updated version of linked-hash-map and friends
Apache License 2.0
98 stars 18 forks source link

error[E0599]: no variant or associated item named `default` found for enum `DefaultHashBuilder` in the current scope #6

Open dkg opened 3 years ago

dkg commented 3 years ago

I'm trying to package hashlink 0.6.0 for debian, and in the course of the standard debian build, I see the following two failures:

debian cargo wrapper: running subprocess (['env', 'RUST_BACKTRACE=1', '/usr/bin/cargo', '-Zavoid-dev-deps', 'build', '--verbose', '--verbose', '-j4', '--target', 'x86_64-unknown-linux-gnu'],) {}
   Compiling hashbrown v0.9.1
     Running `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=hashbrown CARGO_MANIFEST_DIR=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/debian/cargo_registry/hashbrown-0.9.1 CARGO_PKG_AUTHORS='Amanieu d'\''Antras <amanieu@gmail.com>' CARGO_PKG_DESCRIPTION='A Rust port of Google'\''s SwissTable hash map' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=Apache-2.0/MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=hashbrown CARGO_PKG_REPOSITORY='https://github.com/rust-lang/hashbrown' CARGO_PKG_VERSION=0.9.1 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=9 CARGO_PKG_VERSION_PATCH=1 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/debug/deps:/usr/lib' rustc --crate-name hashbrown --edition=2018 /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/debian/cargo_registry/hashbrown-0.9.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="inline-more"' -C metadata=dfc80923e95acd17 -C extra-filename=-dfc80923e95acd17 --out-dir /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/debug/deps --cap-lints warn -C debuginfo=2 --cap-lints warn -C linker=x86_64-linux-gnu-gcc -C link-arg=-Wl,-z,relro --remap-path-prefix /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0=/usr/share/cargo/registry/hashlink-0.6.0`
   Compiling hashlink v0.6.0 (/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0)
     Running `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=hashlink CARGO_MANIFEST_DIR=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0 CARGO_PKG_AUTHORS='kyren <kerriganw@gmail.com>' CARGO_PKG_DESCRIPTION='HashMap-like containers that hold their key-value pairs in a user controllable order' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=hashlink CARGO_PKG_REPOSITORY='https://github.com/kyren/hashlink' CARGO_PKG_VERSION=0.6.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=6 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/debug/deps:/usr/lib' rustc --crate-name hashlink --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=eb6baffa3df7995a -C extra-filename=-eb6baffa3df7995a --out-dir /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -C incremental=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/incremental -L dependency=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/debug/deps --extern hashbrown=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps/libhashbrown-dfc80923e95acd17.rmeta -C debuginfo=2 --cap-lints warn -C linker=x86_64-linux-gnu-gcc -C link-arg=-Wl,-z,relro --remap-path-prefix /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0=/usr/share/cargo/registry/hashlink-0.6.0`
error[E0599]: no variant or associated item named `default` found for enum `DefaultHashBuilder` in the current scope
  --> src/linked_hash_map.rs:50:57
   |
50 |             hash_builder: hash_map::DefaultHashBuilder::default(),
   |                                                         ^^^^^^^ variant or associated item not found in `DefaultHashBuilder`

error[E0599]: no variant or associated item named `default` found for enum `DefaultHashBuilder` in the current scope
  --> src/linked_hash_map.rs:60:57
   |
60 |             hash_builder: hash_map::DefaultHashBuilder::default(),
   |                                                         ^^^^^^^ variant or associated item not found in `DefaultHashBuilder`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.
error: could not compile `hashlink`.

Caused by:
  process didn't exit successfully: `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=hashlink CARGO_MANIFEST_DIR=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0 CARGO_PKG_AUTHORS='kyren <kerriganw@gmail.com>' CARGO_PKG_DESCRIPTION='HashMap-like containers that hold their key-value pairs in a user controllable order' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=hashlink CARGO_PKG_REPOSITORY='https://github.com/kyren/hashlink' CARGO_PKG_VERSION=0.6.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=6 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/debug/deps:/usr/lib' rustc --crate-name hashlink --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=eb6baffa3df7995a -C extra-filename=-eb6baffa3df7995a --out-dir /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -C incremental=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/incremental -L dependency=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/debug/deps --extern hashbrown=/home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0/target/x86_64-unknown-linux-gnu/debug/deps/libhashbrown-dfc80923e95acd17.rmeta -C debuginfo=2 --cap-lints warn -C linker=x86_64-linux-gnu-gcc -C link-arg=-Wl,-z,relro --remap-path-prefix /home/dkg/src/sequoia/2021-03-26/rust-hashlink-0.6.0=/usr/share/cargo/registry/hashlink-0.6.0` (exit code: 1)
dh_auto_test: error: /usr/share/cargo/bin/cargo build returned exit code 101

I'm not a rust expert, so if you think i'm doing something wrong here, i'm happy to get pointers to the right fix.

dkg commented 3 years ago

this is with rustc 1.48.0+dfsg1-2

dkg commented 3 years ago

any word on this? This error is blocking me from uploading hashlink to debian. Maybe there's some versioned dependency that isn't clearly stated?

nathaniel-daniel commented 3 years ago

Looks like DefaultHashBuilder doesn't implement Default when it actually does? I can build the crate from cargo with 1.48.0 so this seems like a problem specific to your build setup.

dkg commented 3 years ago

seems like this might be an issue with hashbrown, then. My attempt to build used hashbrown 0.9.1 (the version currently in debian).

Looks like i've got a bit more work ahead of me to update hashbrown in debian to a more recent version; but perhaps this means that the hashlink dependencies aren't correct?

nathaniel-daniel commented 3 years ago

The Debian hashbrown crate seems bugged. This crate relies on hashbrown having the ahash feature through the use of default features. However, this patch seems to disable ahash completely. The fallback DefaultHashBuilder does not implement Default, and is mostly an empty stand-in. This is why your build fails.

dtolnay commented 3 years ago

I don't know much about Debian but the ahash crate has caused no end of trouble in my own codebase too, so I am not surprised to see it implicated. It intentionally generates a nondeterministic build artifact every time you invoke rustc on it... which I imagine is why Debian wants nothing to do with it.