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

protocols/kad/src/kbuckets: Explicitly convert u8 to usize #1716

Merged
merged 3 commits into from
Aug 19, 2020

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented Aug 19, 2020

Compiling libp2p-kad for --target wasm32-unknown-unknown fails with
the cryptic error message cannot infer type for type usize.
Explicitly converting to usize solves the issue.

961error[E0283]: type annotations needed
962   --> /usr/local/cargo/registry/src/gitpro.ttaallkk.top-1ecc6299db9ec823/libp2p-kad-0.22.0/src/kbucket.rs:123:19
963    |
964123 |         if self.0 == u8::MAX.into() {
965    |                   ^^ cannot infer type for type `usize`
966    |
967    = note: cannot satisfy `usize: std::cmp::PartialEq<_>`

I am not familiar enough with wasm32-unknown-unknown to know the exact cause. In case you deem it to be worth the effort, I am happy to dig deeper into this.

Likely related to rust-lang/rust#71584 and rust-lang/rust#71538.

Needed for paritytech/substrate#6891.

Compiling libp2p-kad for `--target wasm32-unknown-unknown` fails with
the cryptic error message `cannot infer type for type `usize``.
Explicitly converting to `usize` solves the issue.
@mxinden mxinden requested a review from romanb August 19, 2020 14:51
Co-authored-by: Andronik Ordian <write@reusable.software>
Copy link
Contributor

@romanb romanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 For quick patches like this that you want released, the most convenient way is to bump (patch) version and changelog here already and release just this crate on merge. If #1714 is merged before this PR, which contains changes for the next minor release, you may need to make the patch release on a release branch for the prior release and backport it to master.

@mxinden
Copy link
Member Author

mxinden commented Aug 19, 2020

@romanb just to make sure we are on the same page: I will not release a patch version of the root level crate (libp2p) as this is not an urgent security fix. I will only release a patch version of libp2p-kad. Do you agree with that?

@romanb
Copy link
Contributor

romanb commented Aug 19, 2020

@romanb just to make sure we are on the same page: I will not release a patch version of the root level crate (libp2p) as this is not an urgent security fix. I will only release a patch version of libp2p-kad. Do you agree with that?

Yes.

@mxinden mxinden merged commit 740a2e0 into libp2p:master Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants