错误:无法满足依赖关系,所以 `std` 只出现一次

The*_*Cat 9 rust

这是我尝试cargo test在项目中运行时遇到的错误。这是什么意思?我如何解决它?

我可以尝试更新更多细节,但不幸的是,我无法用最小的例子重现它......

完整错误:

cargo test
   Compiling ranges v0.1.0 (file:///Users/user/code/rust-project)
error: cannot satisfy dependencies so `std` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `core` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `collections` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `rustc_unicode` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `alloc` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `rand` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `libc` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `unwind` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot satisfy dependencies so `panic_unwind` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away

error: cannot link together two allocators: alloc_jemalloc and alloc_system

error: aborting due to 10 previous errors
Run Code Online (Sandbox Code Playgroud)

当我尝试运行通过使用箱测试期间编译步骤它发生extern crate:,喜欢这里如何访问文件的src目录从文件在我的测试目录?

在 OS X 上, rustc 1.12.0 (3191fbae9 2016-09-23)

The*_*Cat 8

感谢 Matthieu M. 为我指出正确的github 问题

解决方法是将以下内容放入我的Cargo.toml

crate-type = ["rlib", "dylib"]
Run Code Online (Sandbox Code Playgroud)

如果您正在使用rustc该选项

-C prefer-dynamic
Run Code Online (Sandbox Code Playgroud)

应该可以解决您的问题。