mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
de1d7dbd0f
Remove Iterator #[rustc_on_unimplemented]s that no longer apply. Now that `IntoIterator` is implemented for arrays, all the `rustc_on_unimplemented` for arrays of ranges (e.g. `for _ in [1..3] {}`) no longer apply, since they are now valid Rust. Separated these from #85670, because we should discuss a potential new (clippy?) lint for these. Until Rust 1.52, `for _ in [1..3] {}` produced: ``` error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator --> src/main.rs:2:14 | 2 | for _ in [1..3] {} | ^^^^^^ if you meant to iterate between two values, remove the square brackets | = help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]` = note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end` = note: required by `std::iter::IntoIterator::into_iter` ``` But in Rust 1.53 and later, it compiles fine. It iterates over the array by value, for one iteration with the element `1..3`. This is probably a mistake, which is no longer caught. Should we have a lint for it? Should Clippy have a lint for it? cc ```@estebank``` ```@flip1995``` cc https://github.com/rust-lang/rust/issues/84513 |
||
---|---|---|
.. | ||
alloc | ||
backtrace@221483ebaf | ||
core | ||
panic_abort | ||
panic_unwind | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@37d6e18863 | ||
term | ||
test | ||
unwind |