You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustc 1.14.0 (e8a012324 2016-12-16)
error: borrowed value does not live long enough
--> <anon>:5:9
|
5 | [0, 1].into_iter()
| ^^^^^^ temporary value created here
6 | }.collect::<Vec<_>>();
| - temporary value only lives until here
7 | }
| - temporary value needs to live until here
|
= note: consider using a `let` binding to increase its lifetime
This is very confusing conceptually, since into_iter() is supposed to consume the value it iterates over. Presumably this happens because IntoIterator is only implemented for &[T; N] and &mut [T; N], and not [T; N].
The text was updated successfully, but these errors were encountered:
This yields:
This is very confusing conceptually, since into_iter() is supposed to consume the value it iterates over. Presumably this happens because IntoIterator is only implemented for
&[T; N]
and&mut [T; N]
, and not[T; N]
.The text was updated successfully, but these errors were encountered: