You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#124097 - compiler-errors:box-into-iter, r=WaffleLapkin
Add `IntoIterator` for `Box<[T]>` + edition 2024-specific lints
* Adds a similar method probe opt-out mechanism to the `[T;N]: IntoIterator` implementation for edition 2021.
* Adjusts the relevant lints (shadowed `.into_iter()` calls, new source of method ambiguity).
* Adds some tests.
* Took the liberty to rework the logic in the `ARRAY_INTO_ITER` lint, since it was kind of confusing.
Based mostly off of rust-lang#116607.
ACP: rust-lang/libs-team#263
References rust-lang#59878
Tracking for Rust 2024: rust-lang#123759
Crater run was done here: rust-lang#116607 (comment)
Consensus afaict was that there is too much breakage, so let's do this in an edition-dependent way much like `[T; N]: IntoIterator`.
.addr_metadata_suggestion = use explicit `std::ptr::eq` method to compare metadata and addresses
3
3
.addr_suggestion = use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
4
4
5
-
lint_array_into_iter =
6
-
this method call resolves to `<&{$target} as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <{$target} as IntoIterator>::into_iter in Rust 2021
7
-
.use_iter_suggestion = use `.iter()` instead of `.into_iter()` to avoid ambiguity
8
-
.remove_into_iter_suggestion = or remove `.into_iter()` to iterate by value
9
-
.use_explicit_into_iter_suggestion =
10
-
or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
11
-
12
5
lint_async_fn_in_trait = use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified
13
6
.note = you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`
14
7
.suggestion = you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change
@@ -565,6 +558,13 @@ lint_renamed_lint = lint `{$name}` has been renamed to `{$replace}`
565
558
566
559
lint_requested_level = requested on the command line with `{$level}{$lint_name}`
567
560
561
+
lint_shadowed_into_iter =
562
+
this method call resolves to `<&{$target} as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<{$target} as IntoIterator>::into_iter` in Rust {$edition}
563
+
.use_iter_suggestion = use `.iter()` instead of `.into_iter()` to avoid ambiguity
564
+
.remove_into_iter_suggestion = or remove `.into_iter()` to iterate by value
565
+
.use_explicit_into_iter_suggestion =
566
+
or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
567
+
568
568
lint_span_use_eq_ctxt = use `.eq_ctxt()` instead of `.ctxt() == .ctxt()`
569
569
570
570
lint_supertrait_as_deref_target = this `Deref` implementation is covered by an implicit supertrait coercion
0 commit comments