Skip to content

Commit 48bddb1

Browse files
Rollup merge of rust-lang#97871 - ChayimFriedman2:vec-iterator-unimplemented, r=compiler-errors
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). `@rustbot` label +A-diagnostics
2 parents d486455 + 3c0ab53 commit 48bddb1

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)