about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-07 08:51:58 +0100
committerGitHub <noreply@github.com>2019-11-07 08:51:58 +0100
commitc9eae9ea63abe57d8bb91905d5ca4cff8dd8ea56 (patch)
tree47453a165c08c24ca9b3224506ff74a2f8b053e5 /src/libcore
parente19cb40fda70ea3f75bc1927c114ea53d231b288 (diff)
parent761ba89ffd73498c3014d3b43b5bc0b4f592a284 (diff)
downloadrust-c9eae9ea63abe57d8bb91905d5ca4cff8dd8ea56.tar.gz
rust-c9eae9ea63abe57d8bb91905d5ca4cff8dd8ea56.zip
Rollup merge of #66017 - LukasKalbertodt:array-into-iter-lint, r=matthewjasper
Add future incompatibility lint for `array.into_iter()`

This is for #65819. This lint warns when calling `into_iter` on an array directly. That's because today the method call resolves to `<&[T] as IntoIterator>::into_iter` but that would change when adding `IntoIterator` impls for arrays. This problem is discussed in detail in #65819.

We still haven't decided how to proceed exactly, but it seems like adding a lint is a good idea regardless?

Also: this is the first time I implement a lint, so there are probably a lot of things I can improve. I used a different strategy than @scottmcm describes [here](https://github.com/rust-lang/rust/pull/65819#issuecomment-548667847) since I already started implementing this before they commented.

### TODO

- [x] Decide if we want this lint -> apparently [we want](https://github.com/rust-lang/rust/pull/65819#issuecomment-548964818)
- [x] Open a lint-tracking-issue and add the correct issue number in the code -> https://github.com/rust-lang/rust/issues/66145
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter/traits/collect.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcore/iter/traits/collect.rs b/src/libcore/iter/traits/collect.rs
index 00a86417058..bbdb169cac0 100644
--- a/src/libcore/iter/traits/collect.rs
+++ b/src/libcore/iter/traits/collect.rs
@@ -205,6 +205,7 @@ pub trait FromIterator<A>: Sized {
 ///         .collect()
 /// }
 /// ```
+#[rustc_diagnostic_item = "IntoIterator"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait IntoIterator {
     /// The type of the elements being iterated over.