正如文档中所述Vec必须在1.0-beta中保持稳定。但是,如果我尝试调用resize,我会看到以下错误消息:
错误:使用不稳定的库功能'集合':匹配集合改革规范;等待尘埃落定
它可以很容易地复制,例如在这里:http://is.gd/IhEfEu
fn main() {
let mut v = vec![1, 2, 3, 4];
v.resize(10, 0);
}
答案 0 :(得分:3)
答案 1 :(得分:1)
我认为这是文档中的一个问题。
stable
属性可以应用于包,类型或单个函数,但在文档中,您无法看到函数的弃用状态,只能看到类型和包装箱的弃用状态。
如果你转到the source,你会看到:
impl<T: Clone> Vec<T> {
/// ...
#[unstable(feature = "collections",
reason = "matches collection reform specification; waiting for dust to settle")]
pub fn resize(&mut self, new_len: usize, value: T) {
而且,正如您在此文件中看到的,此模块中仍然存在许多不稳定的函数。