Added check for type unification with the iter

This commit is contained in:
schvv31n 2024-05-21 22:21:33 +01:00
parent b31625cdc7
commit 7439ecb07c
3 changed files with 15 additions and 3 deletions

View file

@ -38,6 +38,10 @@ fn array() {
for i in Option::map_or(smth.as_ref(), [].iter(), |s| s.iter()) {
println!("{i}");
}
// Same as above, but when there are no predicates that mention the collection iter type.
let mut iter = [34, 228, 35].iter();
let _ = std::mem::replace(&mut iter, [].iter());
}
macro_rules! in_macros {

View file

@ -38,6 +38,10 @@ fn array() {
for i in Option::map_or(smth.as_ref(), [].iter(), |s| s.iter()) {
println!("{i}");
}
// Same as above, but when there are no predicates that mention the collection iter type.
let mut iter = [34, 228, 35].iter();
let _ = std::mem::replace(&mut iter, [].iter());
}
macro_rules! in_macros {