substrate-node-template: build error: consider giving `accuracy` a type

Happy New Year 2021! On the first day of 2021, when I build node-template, I encountered following errors:

it looks the same as #108 , **but even if I follow the solution in #108 **, I still got the above error…

$ rustup install nightly-2020-10-05
info: syncing channel updates for 'nightly-2020-10-05-x86_64-apple-darwin'

  nightly-2020-10-05-x86_64-apple-darwin unchanged - rustc 1.49.0-nightly (beb5ae474 2020-10-04)

info: checking for self-updates

$ rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-05
info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date

$ WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release
   Compiling ring v0.16.15
   Compiling snow v0.7.1
   Compiling zstd-sys v1.4.17+zstd.1.4.5
   Compiling libloading v0.5.2
   Compiling sp-arithmetic v2.0.0
   Compiling fork-tree v2.0.0
   Compiling finality-grandpa v0.12.3
error[E0282]: type annotations needed
    --> /Users/treasersmac/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
     |
541  |                   let accuracy = P::ACCURACY.saturated_into();
     |                       ^^^^^^^^ consider giving `accuracy` a type
...
1595 | / implement_fixed!(
1596 | |     FixedI64,
1597 | |     test_fixed_i64,
1598 | |     i64,
...    |
1601 | |     "_Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]_",
1602 | | );
     | |__- in this macro invocation
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
    --> /Users/treasersmac/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
     |
541  |                   let accuracy = P::ACCURACY.saturated_into();
     |                       ^^^^^^^^ consider giving `accuracy` a type
...
1604 | / implement_fixed!(
1605 | |     FixedI128,
1606 | |     test_fixed_i128,
1607 | |     i128,
...    |
1611 | |         [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]_",
1612 | | );
     | |__- in this macro invocation
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
    --> /Users/treasersmac/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
     |
541  |                   let accuracy = P::ACCURACY.saturated_into();
     |                       ^^^^^^^^ consider giving `accuracy` a type
...
1614 | / implement_fixed!(
1615 | |     FixedU128,
1616 | |     test_fixed_u128,
1617 | |     u128,
...    |
1621 | |         [0.000000000000000000, 340282366920938463463.374607431768211455]_",
1622 | | );
     | |__- in this macro invocation
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0282`.
error: could not compile `sp-arithmetic`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

my environment:

$ rustup toolchain list
stable-x86_64-apple-darwin (default)
nightly-2020-10-05-x86_64-apple-darwin
nightly-x86_64-apple-darwin
1.48.0-x86_64-apple-darwin

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 28 (2 by maintainers)

Commits related to this issue

Most upvoted comments

try with this one rustup default nightly-2020-10-05 found it on Element chat group.

@NukeManDan disregard above i was following the instructions on this page https://substrate.dev/docs/en/tutorials/create-your-first-substrate-chain/setup. and i cloned the 2.0.0 version that was listed in the directions. i change the git clone command to 2.0.1 and it built correctly. Not sure who can update those instructions but it needs to be updated. Thanks for the fix !

Had a similar issue here and your suggestion @j-elmer123 worked - thank you

@j-elmer123 your solution works in my environment ubuntu18.04. Thanks a lot!