Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/core/src/iter/traits/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ pub trait IntoIterator {
/// assert_eq!(None, iter.next());
/// ```
#[lang = "into_iter"]
#[must_use = "Iterators do nothing unless iterated over"]
#[stable(feature = "rust1", since = "1.0.0")]
fn into_iter(self) -> Self::IntoIter;
}
Expand Down
2 changes: 1 addition & 1 deletion library/coretests/tests/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fn iterator_drops() {
// Simple: drop new iterator.
let i = Cell::new(0);
{
IntoIterator::into_iter(five(&i));
drop(IntoIterator::into_iter(five(&i)));
}
assert_eq!(i.get(), 5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn call<F>(f: F) where F : Fn() {
fn main() {
let y = vec![format!("World")];
call(|| {
y.into_iter();
let _ = y.into_iter();
//~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
});
}
Loading