Skip to content

Commit 3c0ab53

Browse files
Suggest using iter() or into_iter() for Vec
We cannot do that for `&Vec` because `#[rustc_on_unimplemented]` is limited (it does not clean generic instantiation for references, only for ADTs).
1 parent ec8917c commit 3c0ab53

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/iter/traits/iterator.rs

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
4040
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
4141
),
4242
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
43+
on(
44+
_Self = "std::vec::Vec<T, A>",
45+
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
46+
),
4347
on(
4448
_Self = "&str",
4549
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"

0 commit comments

Comments
 (0)