rustc -L命令找不到板条箱

时间:2019-04-26 05:02:05

标签: rust cargo

我刚开始使用锈。我已经在货物上装了锈,随后又安装了一些包裹,所以现在<Components> <RuntimeRequirements OS="Win64" Platform="AutoCAD" SupportPath="./Contents/"/> ... </Components> 文件夹中有很多箱子:

~/.cargo/registry/cache/github.com-1ecc6299db9ec823

我现在想对来自here的简单源文件使用带有-L选项的rustc命令:

aho-corasick-0.5.3.crate   env_logger-0.4.3.crate    open-1.2.2.crate           regex-0.1.80.crate            textwrap-0.11.0.crate
aho-corasick-0.6.10.crate  gcc-0.3.55.crate          rand-0.3.23.crate          regex-0.2.11.crate            thread-id-2.0.0.crate
aho-corasick-0.7.3.crate   getrandom-0.1.2.crate     rand-0.4.6.crate           regex-1.1.6.crate             thread_local-0.2.7.crate
ansi_term-0.11.0.crate     hoedown-6.0.0.crate       rand-0.6.5.crate           regex-syntax-0.3.9.crate      thread_local-0.3.6.crate
atty-0.2.11.crate          itertools-0.5.10.crate    rand_chacha-0.1.1.crate    regex-syntax-0.5.6.crate      time-0.1.42.crate
autocfg-0.1.2.crate        kernel32-sys-0.2.2.crate  rand_core-0.3.1.crate      regex-syntax-0.6.6.crate      toml-0.2.1.crate
bitflags-0.5.0.crate       lazy_static-0.2.11.crate  rand_core-0.4.0.crate      rustc-serialize-0.3.24.crate  ucd-util-0.1.3.crate
bitflags-1.0.4.crate       lazy_static-1.3.0.crate   rand_hc-0.1.0.crate        rustc_version-0.1.7.crate     unicode-width-0.1.5.crate
cargo-script-0.2.8.crate   libc-0.2.51.crate         rand_isaac-0.1.1.crate     semver-0.1.20.crate           utf8-ranges-0.1.3.crate
cfg-if-0.1.7.crate         log-0.3.9.crate           rand_jitter-0.1.3.crate    semver-0.5.1.crate            utf8-ranges-1.0.2.crate
chan-0.1.23.crate          log-0.4.6.crate           rand_os-0.1.3.crate        semver-parser-0.6.2.crate     vec_map-0.8.1.crate
clap-2.33.0.crate          memchr-0.1.11.crate       rand_pcg-0.1.2.crate       shaman-0.1.0.crate            winapi-0.2.8.crate
either-1.5.2.crate         memchr-2.2.0.crate        rand_xorshift-0.1.1.crate  strsim-0.8.0.crate            winapi-build-0.1.1.crate

但是,此操作失败,并显示以下错误:

extern crate regex;
use regex::Regex;
fn main() {
    let re = Regex::new(r"^\d{4}-\d{2}-\d{2}$").unwrap();
    println!("Did our date match? {}", re.is_match("2014-01-01"));
}

为什么rustc找不到板条箱,该如何解决?感谢您的帮助。

编辑:即使我指定了箱子文件名,也会发生相同的错误:

$ rustc -L ~/.cargo/registry/cache/github.com-1ecc6299db9ec823 hellomain.rs 
error[E0463]: can't find crate for `regex`
 --> hellomain.rs:4:1
  |
4 | extern crate regex;
  | ^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.

0 个答案:

没有答案