这段代码有什么问题?
fn example() {
    let vec = vec![1, 2, 3];
    let &_y = &vec;
}
error[E0507]: cannot move out of borrowed content
 --> src/lib.rs:3:15
  |
3 |     let &_y = &vec;
  |         ---   ^^^^ cannot move out of borrowed content
  |         ||
  |         |data moved here
  |         help: consider removing the `&`: `_y`
  |
note: move occurs because `_y` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
 --> src/lib.rs:3:10
  |
3 |     let &_y = &vec;
  |          ^^ …标题可能不合适,这里是一个例子:
fn foo(impl Fn(&u32) -> bool) { ... }
foo(|x| *x < 100);
foo(|&x| x < 100);
两个闭包是否传递给foo等效项?我在某些地方看到有人使用第二种形式,但我在官方书中找不到它。这&x部分是一个解构...?
&variable在模式或闭包参数中使用它意味着什么?
for &code in self.exit_code.iter() { ... }
let mut new_seps = do seps.iter().fold(~[]) |result, &next| { ... }
下面我们就&code和&next在for循环和封闭的定义.什么&这些的意思是签?为什么我们不能简单地使用code和next没有&符号?它与ref模式匹配中的限定符有关吗?它与特征实现&中的self参数有关吗?
我在当前的Rust参考手册和教程中都找不到任何关于此语法的内容.目前我认为这是某种隐式解除引用(这是从错误消息中得出的,如果我&在模式中省略的话会出现),但我不确定.
编译器说e1: &i32和e2: i32。已经阅读文档用于slice::Iter和上环的书章,我仍然困惑。
更一般而言,切片中的特定元素是否可以拥有?似乎在情况2中,e2拥有一个元素,对吗?
fn main() {
    let slice = &[1, 2, 3];
    for e1 in slice.iter() {
        println!("{}", e1); // case 1
    }
    for &e2 in slice.iter() {
        println!("{}", e2); // case 2
    }
}