Closed
Description
Hi, I noticed that the error for the following code:
#![feature(nll)]
fn main() {
let range = 0 .. 1;
let r = range;
let x = range.start;
}
is this:
error[E0382]: use of moved value: `range.start`
--> src/main.rs:5:13
|
4 | let r = range;
| ----- value moved here
5 | let x = range.start;
| ^^^^^^^^^^^ value used here after move
|
= note: move occurs because `range.start` has type `i32`, which does not implement the `Copy`
Notice the weird error note.
Without NLL enabled, the error becomes the more expected:
error[E0382]: use of moved value: `range.start`
--> src/main.rs:4:9
|
3 | let r = range;
| - value moved here
4 | let x = range.start;
| ^ value used here after move
|
= note: move occurs because `range` has type `std::ops::Range<i32>`, which does not implement the `Copy` trait
I'm running the latest nightly (as of this writing), which I got from rustup.
rustc 1.28.0-nightly (a805a2a5e 2018-06-10)
binary: rustc
commit-hash: a805a2a5ebba2802f432d79874e59c24e398f82a
commit-date: 2018-06-10
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0
Thanks for your time.