有没有解决周转箱命名冲突的方法?

时间:2018-11-15 01:52:37

标签: rust rust-cargo

我想在同一个Rust程序中使用多个MD5实现。

其中两个都希望被命名为“ md5”,这会导致编译器出错:

error[E0465]: multiple rlib candidates for `md5` found
  --> md5s/src/lib.rs:10:1
   |
10 | extern crate md5;
   | ^^^^^^^^^^^^^^^^^
   |
note: candidate #1: /home/dstromberg/src/home-svn/md5s/trunk/target/debug/deps/libmd5-256ebb56f51dbbc0.rlib
  --> md5s/src/lib.rs:10:1
   |
10 | extern crate md5;
   | ^^^^^^^^^^^^^^^^^
note: candidate #2: /home/dstromberg/src/home-svn/md5s/trunk/target/debug/deps/libmd5-56cccd41ff35cdb0.rlib
  --> md5s/src/lib.rs:10:1
   |
10 | extern crate md5;
   | ^^^^^^^^^^^^^^^^^

error[E0463]: can't find crate for `md5`
  --> md5s/src/lib.rs:10:1
   |
10 | extern crate md5;
   | ^^^^^^^^^^^^^^^^^ can't find crate

是否可以在不破坏货物的情况下重命名它们中的一个或两个?

具体的板条箱是:

我有2个Cargo.toml:

$ grep -n . $(find . -name Cargo.toml -print)
below cmd output started 2018 Wed Nov 14 06:03:48 PM PST
./md5s/Cargo.toml:1:[package]
./md5s/Cargo.toml:2:name = "md5s"
./md5s/Cargo.toml:3:version = "0.1.0"
./md5s/Cargo.toml:4:authors = ["xxxxxxxx@gmail.com"]
./md5s/Cargo.toml:6:[dependencies]
./md5s/Cargo.toml:7:rust-crypto = "^0.2"
./md5s/Cargo.toml:8:md5 = "^0.5"
./md5s/Cargo.toml:9:# md-5 = "^0.8.0"
./Cargo.toml:1:# Cargo structure based on https://stackoverflow.com/questions/26946646/rust-package-with-both-a-library-and-a-binary
./Cargo.toml:2:[package]
./Cargo.toml:3:name = "compare-md5s"
./Cargo.toml:4:version = "0.1.0"
./Cargo.toml:5:authors = ["Dan Stromberg <xxxxxxxx@gmail.com>"]
./Cargo.toml:7:[workspace]
./Cargo.toml:9:[dependencies]
./Cargo.toml:10:md5s = { path = "md5s" }
./Cargo.toml:11:rust-crypto = "^0.2"
./Cargo.toml:12:md5 = "^0.5"
./Cargo.toml:13:# md-5 = "^0.8.0"

如果我将2个md-5的注释留在外面,则该项目将生成,如果我取消注释,则会失败并显示以上错误。

在md5s / src / lib.rs中,我有:

extern crate md5;

0 个答案:

没有答案