Skip to content

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

Description

@lilyball

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

Activity

  1. thestinger commented on Aug 24, 2013

    @thestinger
    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.

  2. lilyball commented on Aug 24, 2013

    @lilyball
    ContributorAuthor

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

  3. thestinger commented on Aug 25, 2013

    @thestinger
    Contributor

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

  4. pnkfelix commented on Oct 2, 2013

    @pnkfelix
    Contributor

    probable subbug of #4846

  5. emberian commented on Apr 7, 2014

    @emberian
    Contributor

    No longer reproduces with:

     fn foo<'a, T: Iterator<&'a str>>(it: T) { }
    
     fn main() { }
    
  6. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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