无法识别带连字符的板条箱名称 [英] crate name with hyphens not being recognized

查看:51
本文介绍了无法识别带连字符的板条箱名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

当我尝试运行 Cargo 测试时,它无法识别板条箱名称.我尝试了不同的变体差异平方,差异平方"但没有成功.

Cargo.toml 的内容

我尝试了稳定版本和当前的每晚版本.

解决方案

您可能使用的是旧版本的 Cargo.以前,允许使用带连字符的板条箱,但使用起来很糟糕:

extern crate "difference-of-squares" 作为正方形;

在过去的某个时候,Cargo 被更改为基本上不允许它们;它只是将所有连字符转换为下划线,因此您无需在每次使用时手动重命名名称中包含连字符的每个 crate.

您尚未指定您使用的版本,但更新到最新版本(Rust 1.2 刚刚发布 将在几天内发布)应该会修复它.如果失败,请尝试引用 crate 的字面名称.

I'm trying to practice rust using exercism

one of problem set has a test file like this

when i tried to run Cargo test, its not recognizing the crate name.I tried different variations difference-of-squares,"difference-of-squares" with no success.

contents of Cargo.toml

edit: I tried with both stable release and the current nightly.

解决方案

You're likely using an old version of Cargo. Previously, crates-with-hyphens were allowed, but horrible to use:

extern crate "difference-of-squares" as squares;

At some point in the past, Cargo was changed to basically not allow them; it just converted all hyphens to underscores so you didn't have to manually rename every crate that had hyphens in its name, every time you used it.

You haven't specified what version you're using, but updating to the latest release (Rust 1.2 just got released will be released in a few days) should fix it. Failing that, try quoting the literal name of the crate.

这篇关于无法识别带连字符的板条箱名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆