- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在构建一个基于基板的项目,当我运行 cargo build --release
时,我看到了一些错误。runtime
的 Toml 文件如下 -
runtime/Cargo.toml
[dependencies.codec]
default-features = false
features = ['derive']
package = 'parity-scale-codec'
version = '2.0.0'
[dependencies.frame-benchmarking]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.1.0'
[dependencies.frame-executive]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.frame-system-benchmarking]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.frame-system-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.hex-literal]
optional = true
version = '0.3.1'
[dependencies.pallet-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.pallet-grandpa]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.1.0'
[dependencies.pallet-randomness-collective-flip]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.pallet-sudo]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.pallet-carpooling]
default-features = false
path = '../pallets/carpooling'
version = '3.0.0'
[dependencies.pallet-timestamp]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.pallet-transaction-payment]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.pallet-transaction-payment-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-block-builder]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-consensus-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '0.9.0'
[dependencies.sp-core]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-inherents]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-offchain]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-session]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-std]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-transaction-pool]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.sp-version]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[package]
authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
edition = '2018'
homepage = 'https://substrate.dev'
license = 'Unlicense'
name = 'node-template-runtime'
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '3.0.0'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
[build-dependencies.substrate-wasm-builder]
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '4.0.0'
# local dependencies
[dependencies]
carpooling-runtime-api = {version='3.0.0', default-features = false, path = "../pallets/carpooling/runtime-api" }
[features]
default = ['std']
runtime-benchmarks = [
'frame-benchmarking',
'frame-support/runtime-benchmarks',
'frame-system-benchmarking',
'frame-system/runtime-benchmarks',
'hex-literal',
'pallet-balances/runtime-benchmarks',
'pallet-carpooling/runtime-benchmarks',
'pallet-timestamp/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
]
std = [
'codec/std',
'frame-executive/std',
'frame-support/std',
'frame-system-rpc-runtime-api/std',
'frame-system/std',
'pallet-aura/std',
'pallet-balances/std',
'pallet-grandpa/std',
'pallet-randomness-collective-flip/std',
'pallet-sudo/std',
'pallet-carpooling/std',
'pallet-timestamp/std',
'pallet-transaction-payment-rpc-runtime-api/std',
'pallet-transaction-payment/std',
'sp-api/std',
'sp-block-builder/std',
'sp-consensus-aura/std',
'sp-core/std',
'sp-inherents/std',
'sp-offchain/std',
'sp-runtime/std',
'sp-session/std',
'sp-std/std',
'sp-transaction-pool/std',
'sp-version/std',
'carpooling-runtime-api/std'
]
我看到的错误如下。
error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `panic_impl`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /home/knoldus/Project/Carpooling-Chain/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-45b30cc25a28bf9d.rmeta
= note: second definition in `sp_io` loaded from /home/knoldus/Project/Carpooling-Chain/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-0d2b8d6c1590e857.rmeta
error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `oom`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /home/knoldus/Project/Carpooling-Chain/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-45b30cc25a28bf9d.rmeta
= note: second definition in `sp_io` loaded from /home/knoldus/Project/Carpooling-Chain/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-0d2b8d6c1590e857.rmeta
pallets/carpooling/Cargo.toml
[dev-dependencies.sp-core]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dev-dependencies.sp-runtime]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.codec]
default-features = false
features = ['derive']
package = 'parity-scale-codec'
version = '2.0.0'
[dependencies.frame-benchmarking]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.1.0'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617'
version = '3.0.0'
[features]
default = ['std']
runtime-benchmarks = ['frame-benchmarking']
std = [
'codec/std',
'frame-support/std',
'frame-system/std',
'frame-benchmarking/std',
]
try-runtime = ['frame-support/try-runtime']
[package]
authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
description = 'FRAME pallet template for defining custom runtime logic.'
edition = '2018'
homepage = 'https://substrate.dev'
license = 'Unlicense'
name = 'pallet-carpooling'
readme = 'README.md'
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '3.0.0'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
谁能帮我解决这个问题?
最佳答案
我的解决方案是将此添加到 lib.rs
:
#![cfg_attr(not(feature = "std"), no_std)]
关于rust - 错误 : duplicate lang item in crate `sp_io` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68814981/
我正在将 parking_lot 添加到我的项目中,我希望我的依赖项也可以选择使用它来使用它。 例如,我知道 Tokio 有一个启用 parking_lot 的功能标志,但我想找到所有具有相似功能标志
我想使用 dijkstra来自 pathfinding crate 的函数: pub fn dijkstra( start: &N, neighbours: FN, succe
我有一个 Rust 项目,它在一个工作区中分为多个 crate 。其中一个 crate 是一个测试 crate,它包含用于其他 crate 中的单元和集成测试的实用程序。 在一个 crate 中,我定
此测试代码(playpen): use std::fmt::{Display, Formatter, Error}; struct MyLocalType; type MyResult = Resul
我不小心将我的私有(private)箱子发布到了 crates.io。我该如何删除它?我检查了 documentation但似乎没有办法删除已发布的 crate 。 最佳答案 预防 为避免将来出现这种
有什么比将所有内容都放在同一个模块中更好的方法吗? sub_module.rs pub struct GiantStruct { /* */ } impl GiantStruct { // t
我正在使用Cargo::Ops::Compile()函数使用Cargo::Ops::Compile()函数构建铁锈项目。我在一个json文件中也有一个定制目标。。如何使用目标文件将项目构建到正确目标?
使用hyper crate,我向端点发出了HTTP请求,然后尝试将响应主体传递给期望参数为Futures crate Stream的第三方库。 这导致类型错误。 Cargo.toml [depende
在示例中,hs 从 std 重新导出 HashSet。但它编译时没有错误或警告。为什么? #![no_std] pub use hs::HashSet; pub fn new() -> HashSet
在阅读官方书籍时,我偶然发现了包裹和 crate 。要创建一个新的“项目”,这就是我运行的: $ cargo new my-project Created binary (applicati
在示例中,hs 从 std 重新导出 HashSet。但它编译时没有错误或警告。为什么? #![no_std] pub use hs::HashSet; pub fn new() -> HashSet
我正在尝试编写一些调试辅助宏。所以我创建了一个 crate 来容纳所有这些,并使用 phase(plugin) 在外部引用该 crate : #[cfg(test)] #[phase(plugin)]
每次我看到这样的错误: error: associated constants are experimental (see issue #29646) ... = help: add #![featu
我对 crates.io 上托管的确切内容有点困惑(“ crate ”是指代这些内容的正确方式吗)?我的理解是 crate 是 Rust 中的一个编译单元,但是 crates 和 crates.io
我今天开始学习 Rust,但我卡在了 this step .我想在我的项目中使用 rand crate,所以我按照教程中的建议更新了我的 Cargo.toml: [package] name = "g
我有一个包含大量代码的箱子,所以我将其拆分为多个文件/模块。然而,一些模块有内部不安全的东西(例如原始指针),我需要向不同的模块公开,但我不想暴露给我的 crate 的用户。我该怎么做? 我能想到的唯
我有一个包含大量代码的箱子,所以我将其拆分为多个文件/模块。然而,一些模块有内部不安全的东西(例如原始指针),我需要向不同的模块公开,但我不想暴露给我的 crate 的用户。我该怎么做? 我能想到的唯
Rust 文档中讨论 patching 的部分解释了如何实现补丁,但它使用的所有示例都是为了“测试”和短期修复。我想做的是为我依赖的其中一个 crate 打一个补丁,它会增加它的子依赖性,然后我想在
This question already has answers here: Unable to read file contents to string - Result does not imp
我正在尝试在 Rust 中创建一个模块,然后从不同的文件中使用它。这是我的文件结构: matthias@X1:~/projects/bitter-oyster$ tree . ├── Cargo.lo
我是一名优秀的程序员,十分优秀!