Skip to content

ICE: function returning UnfoldrIterator #6126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gifnksm opened this issue Apr 30, 2013 · 1 comment
Closed

ICE: function returning UnfoldrIterator #6126

gifnksm opened this issue Apr 30, 2013 · 1 comment

Comments

@gifnksm
Copy link
Contributor

gifnksm commented Apr 30, 2013

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.

@yichoi
Copy link
Contributor

yichoi commented Jun 26, 2013

current code cannot be compiled

foldr.rs:11:11: 11:53 error: mismatched types: expected `std::iterator::UnfoldrIterator<,uint,(uint,int)>` but found `std::iterator::UnfoldrIterator<,(uint,int),(uint,int)>` (expected uint but found tuple)
foldr.rs:11     return UnfoldrIterator::new(next, (start, step));
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

if fn next changed like below, it can be compiled without ICE

fn next(st: &mut (uint, int)) -> Option<uint> {
    None
}

It looks to me not a issue.

@yichoi yichoi closed this as completed Jun 26, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 9, 2020
Rustup

Supersedes rust-lang#6121. There was another breakage.

r? `@ghost`

changelog: none
flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 9, 2020
…=flip1995

Reinstate test for forbid(clippy::restriction)

In [this commit](rust-lang/rust-clippy@5747c15) coming from rust-lang/rust (rust-lang#6126) the test for `#![forbid(clippy::restriction)]` was removed because some restriction lints were being allowed after the forbid.

This change reinstates the test for `forbid` by using a separate file.

changelog: none

r? `@flip1995`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants