about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-14 10:31:07 +0100
committerGitHub <noreply@github.com>2022-12-14 10:31:07 +0100
commite5fde968dbbb87e5721ff5da91a49cab88b90b91 (patch)
treef4231abd6871b3db90878f69a953115e36fcc2d7 /library/core/src
parentc8fd654d7ce2ab5a4945cead8a947f923b98f5a5 (diff)
parent40a62758a7db892a47cb59de85612e8a5b9ab267 (diff)
downloadrust-e5fde968dbbb87e5721ff5da91a49cab88b90b91.tar.gz
rust-e5fde968dbbb87e5721ff5da91a49cab88b90b91.zip
Rollup merge of #105523 - estebank:suggest-collect-vec, r=compiler-errors
Suggest `collect`ing into `Vec<_>`

Fix #105510.
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/iter/traits/iterator.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 83c7e8977e9..1cdee992137 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1829,6 +1829,7 @@ pub trait Iterator {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"]
+    #[cfg_attr(not(test), rustc_diagnostic_item = "iterator_collect_fn")]
     fn collect<B: FromIterator<Self::Item>>(self) -> B
     where
         Self: Sized,