Add IntoIterator and support to fallback to calling iterator.into_iter()
on failure
#5568
Labels
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
team:compiler
Compiler Team
Right now we need to call iter() on a vector to use a for loop.
The proposed change in this issue is to desugar the for loop into two expressions the default one we already have and another one that tries to automatically call the fully qualified path .into_iter() method on the iterator part of the for. When the first desugared expression fails to compile we would try to use the second one.
An example of this on rust is https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6bcab16907b3a79b239249ba98557afe
The text was updated successfully, but these errors were encountered: