]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-21245.rs
3 // Regression test for issue #21245. Check that we are able to infer
4 // the types in these examples correctly. It used to be that
5 // insufficient type propagation caused the type of the iterator to be
6 // incorrectly unified with the `*const` type to which it is coerced.
8 // pretty-expanded FIXME #23616
15 fn into_iter2(self) -> Self::Iter
;
18 impl<I
> IntoIterator
for I
where I
: Iterator
{
21 fn into_iter2(self) -> I
{
26 fn desugared_for_loop_bad
<T
>(v
: Vec
<T
>) {
27 match IntoIterator
::into_iter2(v
.iter()) {
30 match ::std
::iter
::Iterator
::next(&mut iter
) {
31 ::std
::option
::Option
::Some(x
) => {
32 unsafe { ptr::read(x); }
34 ::std
::option
::Option
::None
=> break
41 fn desugared_for_loop_good
<T
>(v
: Vec
<T
>) {
42 match v
.iter().into_iter() {
45 match ::std
::iter
::Iterator
::next(&mut iter
) {
46 ::std
::option
::Option
::Some(x
) => {
47 unsafe { ptr::read(x); }
49 ::std
::option
::Option
::None
=> break