在 substrate.dev 中构建失败 墨迹! 教程. sp-aritmetic 缺乏类型?



我的构建失败了。

一切看起来都很好,直到我用命令测试了我的合同:

cargo +nightly test

我收到错误 [E0282]

以下是整个错误报告:

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

这是更广泛教程的一部分。

我相信锈蚀是更新的。

问题似乎是宏 sp-aritmetic,但我不确定如何给它一个"类型"。我的锈迹不存在...

真的很想进入墨水!所以任何帮助都是值得赞赏的。

该错误的原因是从版本 2020-10-06 开始的 rust 夜间编译器中的回归。您需要rustup toolchain install 2020-10-05并使用该运行时来构建运行时,直到此问题得到解决。通常,最新的每晚会自动用于构建运行时。您可以通过设置WASM_BUILD_TOOLCHAIN环境变量来覆盖此行为。在这种情况下:

export WASM_BUILD_TOOLCHAIN='nightly-2020-10-05'

在与货物合同签订合同的情况下,您应该使用:

cargo +nightly-2020-10-05 contract build 

相关内容

最新更新