Skip to content
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

rp.is_none ICE with fn taking <'self, T: Iterator<&'self str>> #8741

Closed
lilyball opened this issue Aug 24, 2013 · 5 comments
Closed

rp.is_none ICE with fn taking <'self, T: Iterator<&'self str>> #8741

lilyball opened this issue Aug 24, 2013 · 5 comments

Comments

@lilyball
Copy link
Contributor

Reduced test case:

fn foo<'self, T: Iterator<&'self str>>(it: T) { }

fn main() { }

Original bug report follows:


The following function declaration triggers an ICE

fn foo<'self, T: Iterator<&'self str>>(it: T) -> ~[&'self str] {
    it.to_owned_vec()
}

fn main() {
    let xs = "a/b/c";
    printfln!(xs.split_iter('/'))
}

The failure is

task <unnamed> failed at 'assertion failed: rp.is_none()', /Users/kevin/Dev/rust/rust/src/librustc/middle/typeck/collect.rs:1097
@thestinger
Copy link
Contributor

You can't use the 'self lifetime outside of an impl. The special case for 'self just needs to be removed and this issue will go away.

@lilyball
Copy link
Contributor Author

I was surprised that it required me to use 'self here, but apparently it won't let me use Iterator<&'a str>.

@thestinger
Copy link
Contributor

The workaround is to implement everything with ad-hoc traits until 'self isn't special anymore.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2013

probable subbug of #4846

@emberian
Copy link
Member

emberian commented Apr 7, 2014

No longer reproduces with:

 fn foo<'a, T: Iterator<&'a str>>(it: T) { }

 fn main() { }

@emberian emberian closed this as completed Apr 7, 2014
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

4 participants