rust - "use of unstable library feature ' 集合 '"每晚使用

标签 rust

这个

fn main() {

    let test = "Foo".to_string();
    test.to_lowercase();

}

产生错误

error: use of unstable library feature 'collections'
       test.to_lowercase();
            ^~~~~~~~~~~~~~

但我正在使用

rustc 1.2.0-nightly (f76d9bcfc 2015-05-28) (built 2015-05-28)

并根据http://doc.rust-lang.org/1.0.0/book/release-channels.html每晚启用不稳定的功能。我也试过稳定版和测试版,但错误完全一样。那么这里的问题是什么?

最佳答案

您需要通过将 #![feature(collections)] 放在 crate 根源文件的顶部来明确选择加入。使用夜间编译器仅允许您使用不稳定的功能,它不会自动启用它们。

另见 related SO question .

关于rust - "use of unstable library feature ' 集合 '"每晚使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30506120/

相关文章:

rust - Rust:如何在功能链中使用await

python - 为了使用 Python 从 Rust 程序内部调用函数,应遵循的最佳实践是什么?

rust - 如何将枚举值与整数匹配?

rust - 如何在匹配中使用表达式作为条件?

rust - 删除 crate 功能

csv - 在 `ReaderBuilder` 中找不到 `csv`

casting - 为什么作为引用的迭代器项不转换为特征对象引用?

rust - 哪种获取结构字段引用的方法是首选方法?

multithreading - 在Vec上实现并行/多线程合并排序

rust - 将 Option<Box<[Box<[JsValue]>]>> 从 Rust fn 返回到 Wasm 的替代方法