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
For the following code, it seems the compiler was unable to optimize away the loop for the first 2 functions.
pubfnvec(foo:Vec<&[i32]>) -> usize{into_iter_last(foo.into_iter())}pubfnvec2(foo:Vec<&[i32]>) -> usize{into_iter_last(foo.into_iter().map(|s| *&s))}pubfnvec3(foo:Vec<&[i32]>) -> usize{into_iter_last(foo.iter().map(|s| *s))}pubfnslice(foo:&[&[i32]]) -> usize{into_iter_last(foo.into_iter().map(|s| *s))}pubfninto_iter_last<'a>(mutfoo:implIterator<Item = &'a[i32]>) -> usize{letmut res = 0;whileletSome(slice) = foo.next(){
res = slice.len();}
res
}
This seems to be only happening for Vec and not slice. Seems like the compiler forgets that slice ptr cannot be null and unable to optimize away the loop.
For the following code, it seems the compiler was unable to optimize away the loop for the first 2 functions.
This seems to be only happening for Vec and not slice. Seems like the compiler forgets that slice ptr cannot be null and unable to optimize away the loop.
https://rust.godbolt.org/z/7EvqWE7vv
The text was updated successfully, but these errors were encountered: