首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在substrate.dev墨迹中构建失败!教程。sp-是否缺少类型?

在substrate.dev墨迹中构建失败!教程。sp-是否缺少类型?
EN

Stack Overflow用户
提问于 2020-10-19 22:43:32
回答 1查看 345关注 0票数 0

我的构建失败了。

在我用命令测试我的契约之前,一切看起来都很好:

代码语言:javascript
复制
cargo +nightly test

我收到错误E0282

下面是完整的错误报告:

代码语言:javascript
复制
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`

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

我相信rust已经更新了。

问题似乎出在宏算法上,但是我不确定如何给它一个“类型”。我的铁锈是不存在的。

非常渴望进入Ink!因此,任何帮助都是非常感谢的。

EN

回答 1

Stack Overflow用户

发布于 2020-10-19 23:21:18

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

代码语言:javascript
复制
export WASM_BUILD_TOOLCHAIN='nightly-2020-10-05'

在使用货物合同建立合同的情况下,您应该使用:

代码语言:javascript
复制
cargo +nightly-2020-10-05 contract build 
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64429708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档