Amiya Behera
Amiya Behera

Reputation: 2270

Error while build error[E0282]: type annotations needed

error[E0282]: type annotations needed
    --> /home/amiya/.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
    --> /home/amiya/.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
    --> /home/amiya/.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

I am using Ubuntu 20.04, its giving same error for both
WASM_BUILD_TOOLCHAIN=nightly-2020-08-23 cargo build --release
and
WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release

https://github.com/substrate-developer-hub/substrate-node-template/blob/4d97032c11b8c65936e53a61607d4522d45a29ea/Makefile

https://stackoverflow.com/a/63993797/1566713

Upvotes: 1

Views: 1140

Answers (3)

Oscar
Oscar

Reputation: 61

This was fixed already in v2.0.1, try deleting the project and cloning again using the following command.

git clone -b v2.0.1 --depth 1 https://github.com/substrate-developer-hub/substrate-node-template

Upvotes: 1

aurexav
aurexav

Reputation: 2865

Here's the issue https://github.com/paritytech/substrate/issues/7287

Solve with just this single line

rustup default nightly-2020-10-06 && rustup target add wasm32-unknown-unknown

Upvotes: 1

Nuke
Nuke

Reputation: 1082

Note: This should be fixed soon in substrate v2.0.1

For now you may need to downgrade your toolchain: https://substrate.dev/docs/en/knowledgebase/getting-started/#downgrading-rust-nightly

The known working date for me is 2020-10-5 for all toolchains, and the default uses nightly from that date.

I am on Ubuntu 20.04LTS as well, and use:

$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  ....

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-2020-10-05-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-2020-10-05-x86_64-unknown-linux-gnu (default)
rustc 1.49.0-nightly (beb5ae474 2020-10-04)

Upvotes: 2

Related Questions