]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #84147 - cuviper:array-method-dispatch, r=nikomatsakis,m-ou-se
authorbors <bors@rust-lang.org>
Sun, 25 Apr 2021 07:26:49 +0000 (07:26 +0000)
committerbors <bors@rust-lang.org>
Sun, 25 Apr 2021 07:26:49 +0000 (07:26 +0000)
Cautiously add IntoIterator for arrays by value

Add the attribute described in #84133, `#[rustc_skip_array_during_method_dispatch]`, which effectively hides a trait from method dispatch when the receiver type is an array.

Then cherry-pick `IntoIterator for [T; N]` from #65819 and gate it with that attribute. Arrays can now be used as `IntoIterator` normally, but `array.into_iter()` has edition-dependent behavior, returning `slice::Iter` for 2015 and 2018 editions, or `array::IntoIter` for 2021 and later.

r? `@nikomatsakis`
cc `@LukasKalbertodt` `@rust-lang/libs`

1  2 
compiler/rustc_feature/src/builtin_attrs.rs
compiler/rustc_span/src/symbol.rs
compiler/rustc_typeck/src/check/method/probe.rs
library/core/src/array/mod.rs
library/std/src/primitive_docs.rs

Simple merge
Simple merge
Simple merge