Skip to content

ICE: function returning UnfoldrIterator #6126

Closed
@gifnksm

Description

@gifnksm

The following code causes ICE.

use core::iterator::{ UnfoldrIterator };

pub fn uint_range(start: uint, end: uint, step: int) -> UnfoldrIterator<uint, (uint, int)>
{
    fn next(st: &mut (uint, int)) -> Option<(uint, int)> {
        None
    }

    return UnfoldrIterator::new(next, (start, step));
}
$ rustc  foldr.rs
error: internal compiler error: ty::Region#subst(): Reference to self region when given substs with no self region: substs(self_r=None, self_ty=None, tps=[<V3>,<V4>])

rustc seems to fail to suggest 'self region of UnfoldrIterator<'self>,
but I don't know the appropriate region name for this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions